By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,761 Members | 959 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,761 IT Pros & Developers. It's quick & easy.

Javascript onLoad Issue...

chunk1978
100+
P: 224
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.

Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <head>
  3. <script type="text/javascript">
  4.  
  5. function HideEmptyFields()
  6.     {
  7.     if (document.getElementById('addressline2').value != '') {document.getElementById('DIVaddressline2').style.display == 'block';
  8.     }
  9. }
  10.  
  11. </script>
  12. </head>
  13. <body onLoad="HideEmptyFields();">
  14.  
  15. <div id="DIVaddressline2" style="display:none;"><input type="text" name="addressline2" id="addressline2" value="AL2"><br></div>
  16.  
  17. </body>
  18. </html>
  19.  
Feb 22 '07 #1
Share this Question
Share on Google+
2 Replies

chunk1978
100+
P: 224
oops! nevermind... it should have been "style.display = 'block';" instead of "style.display == 'block';"
Feb 22 '07 #2

acoder
Expert Mod 15k+
P: 16,027
oops! nevermind... it should have been "style.display = 'block';" instead of "style.display == '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.
Feb 22 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.