Results 1 to 8 of 8

Thread: document.getElementByID is null... with dropdown tabs

  1. #1
    Join Date
    Dec 2008
    Posts
    3
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default document.getElementByID is null... with dropdown tabs

    1) Script Title: Drop Down Tabs (5 Styles)

    2) Script URL (on DD):
    http://dynamicdrive.com/dynamicindex1/droptabmenu.htm

    3) Describe problem:
    In IE the lower left hand corner error tells me
    Line: 136
    Char: 3
    Error: 'document.getElementByID(...)' is null or not an object
    Code:0

    This problem does not seem to occur in firefox. I would ignore this issue but when linking to the page from my help file, errors pop up.

    The script in the header is

    Code:
    <script type="text/javascript" src="js/dropdowntabs.js">
    
    /***********************************************
    * Drop Down Tabs Menu- (c) Dynamic Drive DHTML code library (www.dynamicdrive.com)
    * This notice MUST stay intact for legal use
    * Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
    ***********************************************/
    
    </script>
    <script type="text/javascript">
    //SYNTAX: tabdropdown.init("menu_id", [integer OR "auto"])
    tabdropdown.init("bluemenu", 0)
    </script>
    Sorry if this question has been answered before, i'm just a javascript newbie so i couldn't find anything that was clear enough to directly answer this for me.
    Last edited by mikeusru; 12-31-2008 at 06:02 PM.

  2. #2
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    Please post a link to the page on your site that contains the problematic script so we can check it out.
    DD Admin

  3. #3
    Join Date
    Dec 2008
    Posts
    3
    Thanks
    1
    Thanked 0 Times in 0 Posts

  4. #4
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    There is an error in Firefox as well, it's just not as apparent. And the menu works in both browsers. However, to get rid of the error you need to remove (highlighted):

    Code:
    <script type="text/javascript" src="js/dropdowntabs.js">
    
    /***********************************************
    * Drop Down Tabs Menu- (c) Dynamic Drive DHTML code library (www.dynamicdrive.com)
    * This notice MUST stay intact for legal use
    * Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
    ***********************************************/
    
    </script>
    <script type="text/javascript">
    //SYNTAX: tabdropdown.init("menu_id", [integer OR "auto"])
    tabdropdown.init("bluemenu", 0)
    </script>
    <!-- Codes by Quackit.com -->
    <script type="text/javascript">
    // Popup window code
    function newPopup(url) {
    	popupWindow = window.open(
    		url,'popUpWindow','height=700,width=800,left=10,top=10,resizable=yes,scrollbars=yes,toolbar=yes,menubar=no,location=no,directories=no,status=yes')
    }
    </script>
    
    
    </head>
    from the head of the page. It should only appear once on the page, and must follow the markup for the menu. Since you already have it in the latter location, simply getting rid of it from the head will be all you need to do.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  5. The Following User Says Thank You to jscheuer1 For This Useful Post:

    mikeusru (12-31-2008)

  6. #5
    Join Date
    Dec 2008
    Posts
    3
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    Worked like a charm, thanks so much!

  7. #6
    Join Date
    Nov 2008
    Posts
    11
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    I am having same issue, but I only see the code once on the page, at the very end right before the </body> tag, I don't have it in the head.

    Only seems to affect IE7 and 8

    Page is here: http://p2008.pearsonfuneralhome.com/index.php

  8. #7
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    No, that actually is a different line in the script, so it is a different problem. In this case you have no element with the id 'servmenu', but you do have an item in the 'nav' menu with a rel 'servmenu' which directs the script to look for it. Either create a dropdown with the id 'servmenu', or remove the rel attribute from here:

    Code:
     <li><a href="/services/funeral-services/" rel="servmenu">Types of <br />Services</a>&nbsp;&nbsp;&nbsp;&nbsp;</li>
    Once again, all browsers see this as an error, only IE makes a big deal about it, and the menu still works.

    In IE error reporting is turned on by default. In other browsers, one must use special tools for those browsers and/or turn on error reporting.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  9. #8
    Join Date
    Nov 2008
    Posts
    11
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    Good catch, had that in there for future changes, so will take out.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •