Javascript onLoad Issue...

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • chunk1978
    New Member
    • Jan 2007
    • 224

    Javascript onLoad Issue...

    hello...

    to me, the following code makes perfect sense... but it's just not working... i've clearly missed something... any help would be appreciated.

    Code:
    <html>
    <head>
    <script type="text/javascript">
    
    function HideEmptyFields()
    	{
    	if (document.getElementById('addressline2').value != '') {document.getElementById('DIVaddressline2').style.display == 'block';
    	}
    }
    	
    </script>
    </head>
    <body onLoad="HideEmptyFields();">
    
    <div id="DIVaddressline2" style="display:none;"><input type="text" name="addressline2" id="addressline2" value="AL2"><br></div>
    
    </body>
    </html>
  • chunk1978
    New Member
    • Jan 2007
    • 224

    #2
    oops! nevermind... it should have been "style.disp lay = 'block';" instead of "style.disp lay == 'block';"

    Comment

    • acoder
      Recognized Expert MVP
      • Nov 2006
      • 16032

      #3
      Originally posted by chunk1978
      oops! nevermind... it should have been "style.disp lay = 'block';" instead of "style.disp lay == 'block';"
      A common mistake. In Coldfusion, incidentally, there can't be any confusion because you can only use = for setting, and use "EQ" for comparing.

      Comment

      Working...