Forum Moderators: open

Message Too Old, No Replies

getElementByID "has no properties" Error

I must be missing something...

         

Jay_R

9:18 pm on Jul 19, 2004 (gmt 0)

10+ Year Member



Ok, looking at other posts and books and resources, this should work. What did I do wrong?

<html>
......
<script type="text/javascript" language="javascript">
<!--
document.getElementById('javaOff').style.display = "none";
//-->
</script>

......

<div id="javaOff">JavaScript Warning</div>

......
</html>

I just get a "javaOff" has no properties error from FireFox, and IE's Debugger complains because there's no object to reference. Any ideas?
-Jay

coopster

9:54 pm on Jul 19, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Probably because it isn't defined yet at that point. Move the <script> block below your <div> and try again.

Jay_R

10:13 pm on Jul 19, 2004 (gmt 0)

10+ Year Member



Not only does that make sense, it worked! Thanks coopster.

-Jay