- Joined
- Mar 17, 2008
- Messages
- 1
- Reaction score
- 0
hi,
I'm trying to update an asp label with a javascript function. In Page_Load:
protected void Page_Load(object sender, EventArgs e)
{
Page.RegisterStartupScript("MyScript",
"<script language=javascript>" + "function displayMessage() { document.forms[0]['VistaLabel'].value='Display this message'; }</script>");
RadioButton2.Attributes["onclick"] = "displayMessage()";
}
... VistaLabel is the name of my asp:Label. The onclick is working fine if I change this to use an alert(), but I can't seem to change the asp:Label, I've also tried using GetElementById but that doesn't work either. Can someone suggest a syntax that works?
thanks,
matt
I'm trying to update an asp label with a javascript function. In Page_Load:
protected void Page_Load(object sender, EventArgs e)
{
Page.RegisterStartupScript("MyScript",
"<script language=javascript>" + "function displayMessage() { document.forms[0]['VistaLabel'].value='Display this message'; }</script>");
RadioButton2.Attributes["onclick"] = "displayMessage()";
}
... VistaLabel is the name of my asp:Label. The onclick is working fine if I change this to use an alert(), but I can't seem to change the asp:Label, I've also tried using GetElementById but that doesn't work either. Can someone suggest a syntax that works?
thanks,
matt