I know this is more of a javascript question, but it's in an asp.net page, so I'm hoping I'm still on topic.
I have a asp.net page, with a public label (lbl_Error) that I want to check and see if it's populated with any text... if so, I want to pop that text up in an alert. If not, just ignore...
For example, this is the code I've been trying with no luck:
Whenever I run this, I get a message from the browser that "documents.forms.0.lbl_Error is null or is not an object."
I've checked it for null, using:
But that doesn't seem to work either. With everthing I try I either get the above error message, or it just does nothing.
Can any help me with the right syntax for this?
Thanks!
I have a asp.net page, with a public label (lbl_Error) that I want to check and see if it's populated with any text... if so, I want to pop that text up in an alert. If not, just ignore...
For example, this is the code I've been trying with no luck:
if(document.forms[0].lbl_Error.text != "")
{
window.alert(document.forms[0].lbl_Error.text);
}
Whenever I run this, I get a message from the browser that "documents.forms.0.lbl_Error is null or is not an object."
I've checked it for null, using:
if (document.forms[0].lbl_Error != Null)
But that doesn't seem to work either. With everthing I try I either get the above error message, or it just does nothing.
Can any help me with the right syntax for this?
Thanks!