Title: Javascript getElementById Error in Header
Last modified: August 19, 2016

---

# Javascript getElementById Error in Header

 *  [altexasgirl](https://wordpress.org/support/users/altexasgirl/)
 * (@altexasgirl)
 * [17 years, 11 months ago](https://wordpress.org/support/topic/javascript-dropdown-menu-error-in-header/)
 * Hi,
 * I’m having trouble with a javascript error at my site, [http://www.onthebaseline.com](http://www.onthebaseline.com).
 * Whenever a page loads in IE or Firefox, it posts an error message saying “document.
   getElementById (“topnav”) has no properties. Line 110)” in Firefox and “document.
   getElementById(….) is null or not an object”, also on Line 110 in IE.
 * I suspect the problem has to do with our drop-down header javascript code, which
   I have copied below. Could someone please tell me what needs to be changed in
   hopes of getting rid of the error message. Thank you!!!!
 * >  <script type=”text/javascript” src=”[http://www.onthebaseline.com/wp-content/themes/Simplicity10/ruthsarian_utilities.js”></script&gt](http://www.onthebaseline.com/wp-content/themes/Simplicity10/ruthsarian_utilities.js”></script&gt);
   > 
   > <script type=”text/javascript”> <!– event_attach( ‘onload’ , function () { 
   > sfHover( ‘nav-menu’ ); } ); //–> </script>
   > <script type=”text/javascript” src=”<?php bloginfo(‘stylesheet_directory’);?
   > >/js/tabber.js”></script>
   >  <script type=”text/javascript” src=”<?php bloginfo(‘
   > stylesheet_directory’); ?>/js/prototype.js”></script> <script type=”text/javascript”
   > src=”<?php bloginfo(‘stylesheet_directory’); ?>/js/effects.js”></script> <script
   > type=”text/javascript” src=”<?php bloginfo(‘stylesheet_directory’); ?>/js/glider.
   > js”></script>
   > <script type=”text/javascript”><!–//–><![CDATA[//><!–
   >  sfHover = function(){
   > var sfEls = document.getElementById(“nav”).getElementsByTagName(“LI”); for (
   > var i=0; i<sfEls.length; i++) { sfEls[i].onmouseover=function() { this.className
   > +=” sfhover”; } sfEls[i].onmouseout=function() { this.className=this.className.
   > replace(new RegExp(” sfhover\\b”), “”); } } } if (window.attachEvent) window.
   > attachEvent(“onload”, sfHover); //–><!]]></script>
   > <script type=”text/javascript”><!–//–><![CDATA[//><!–
   >  sfHover = function(){
   > var sfEls = document.getElementById(“topnav”).getElementsByTagName(“LI”); for(
   > var i=0; i<sfEls.length; i++) { sfEls[i].onmouseover=function() { this.className
   > +=” sfhover”; } sfEls[i].onmouseout=function() { this.className=this.className.
   > replace(new RegExp(” sfhover\\b”), “”); } } } if (window.attachEvent) window.
   > attachEvent(“onload”, sfHover); //–><!]]></script>
   > <script type=”text/javascript”>
   >  function display(id) { if (document.getElementById(
   > id).style.display == ‘block’) { document.getElementById(id).style.display =‘
   > none’; } else { document.getElementById(id).style.display = ‘block’; } return
   > false; } </script>
   > <script type=”text/javascript”>
   >  function display(id) { if (document.getElementById(
   > id).style.display == ‘block’) { document.getElementById(id).style.display =‘
   > none’; } else { document.getElementById(id).style.display = ‘block’; } return
   > false; } </script>

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [mahmood](https://wordpress.org/support/users/mahmood/)
 * (@mahmood)
 * [17 years, 11 months ago](https://wordpress.org/support/topic/javascript-dropdown-menu-error-in-header/#post-780731)
 * I’m sorry I don’t have an answer to your problem, but could you let me know how
   you integrated the glider into your theme? Much appreciate it if you would post
   that section of the code here. Thanks.
 *  Thread Starter [altexasgirl](https://wordpress.org/support/users/altexasgirl/)
 * (@altexasgirl)
 * [17 years, 11 months ago](https://wordpress.org/support/topic/javascript-dropdown-menu-error-in-header/#post-780745)
 * Hi mahmood –
 * The code for the glider was designed by Michael Pollock of Solostream. You can
   find more information about the featured slideshow here:
 * [http://www.solostream.com/2007/11/29/wordpress-magazine-theme-wp-magazine-theme-10/](http://www.solostream.com/2007/11/29/wordpress-magazine-theme-wp-magazine-theme-10/)

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Javascript getElementById Error in Header’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2 replies
 * 2 participants
 * Last reply from: [altexasgirl](https://wordpress.org/support/users/altexasgirl/)
 * Last activity: [17 years, 11 months ago](https://wordpress.org/support/topic/javascript-dropdown-menu-error-in-header/#post-780745)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
