Checking to see if a label's text is empty
Hi,
I've been getting errors saying "Object required" when I try to check the contents of a label's text. I'm trying to have the function execute only if the label's text is blank. The following is my code:
<script>
function NewWindow()
{
if (document.getElementById("txtpostdte").value != "")
{
var rptdate=document.getElementById("txtpostdte").valu e;
var err=document.getElementById("lblerror").innerHTML;
if (err = "")
{
window.open("TyDly.aspx?postdte=" + rptdate);
}
}
}
</script>
The error is pointing to where I set the variable 'err' equal to the lblerror's text. Is there something I'm doing wrong? I tried .innertext, .text, .value and still nothing works. In addition, is there any chance that I can combine both the txtpostdte and lblerror's conditions together? When I try to do it, I get an error. Any help is greatly appreciated. Thanks.
And, I'm not sure if this is the forum to post this in. If not, can someone please point me in the right direction? Thanks again.
|