PDA

View Full Version : Resolved document.getElementByID is null... with dropdown tabs



mikeusru
12-30-2008, 10:10 PM
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


<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.

ddadmin
12-31-2008, 01:12 AM
Please post a link to the page on your site that contains the problematic script so we can check it out.

mikeusru
12-31-2008, 02:58 PM
Sure thing,
the page is
http://pimexonline.com/atplayer.html

the script is
http://pimexonline.com/js/dropdowntabs.js

Thanks!

jscheuer1
12-31-2008, 03:55 PM
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):


<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.

mikeusru
12-31-2008, 06:01 PM
Worked like a charm, thanks so much!

ecp5
01-05-2009, 10:55 PM
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

jscheuer1
01-06-2009, 12:01 AM
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:


<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.

ecp5
01-06-2009, 02:42 AM
Good catch, had that in there for future changes, so will take out.