View Full Version : IE only error in mouse over menu

01-08-2009, 02:31 AM
New here and noticed that you guys have some great solutions. Convinced me to sign up and join. Maybe I would be able to help out as well. :p

I am using the Mouseover Tabs Menu (http://www.dynamicdrive.com/dynamicindex1/mouseovertabs.htm), I attached the .js file below.
It works great on all browsers except of course for IE.
Whenever I run the script I get the small annoying yellow error at the bottom indicating the page loaded but with errors.

Error: Object doesn't support this property or method

Here is the block of code. Line 21 begins with if (/^gotsubmenu/i.test(relattr)
Any clue on what do I need to do in order to solve this?

Thanks in advance!

initializetabs:function(tabsmenuid, submenuid, tabcontentsLength, disappearBool){
var tabmenu=document.getElementById(tabsmenuid)
var tablinks=tabmenu.getElementsByTagName("a")
var submenu=document.getElementById(submenuid)
var selected=null, tablinks_count=0
for (var i=0; i<tablinks.length; i++){
var relattr=tablinks[i].getAttribute("rel")
if (/^gotsubmenu/i.test(relattr) && tablinks_count<tabcontentsLength){ //if "rel" attribute starts with="gotsubmenu" and a tab content exists for this tab based on its order
tablinks[i]._pos=tablinks_count //remember position of this tab relative to its active peers
if (relattr.indexOf("[selected]")!=-1){
this.addEvent(tablinks[i], function(){
var tabsmenutree=mouseovertabsmenu.tabsmenutree[this._parentid]
}, "mouseover")
this.tabsmenutree[tabsmenuid].tabs.push(tablinks[i]) //add this tab to tab collection
else{ //else for regular tab links (with no "rel" attribute)
this.addEvent(tablinks[i], function(){
}, "mouseover")

01-08-2009, 10:11 AM
Do you have a link to the problem page we can check out? Also, by IE, I gather you mean IE7?

01-08-2009, 02:28 PM
Yea IE7,
Don't have a link sorry, Any chance of getting it from the code?

01-08-2009, 05:41 PM
Not from the code you've posted. Most likely you've mixed things up a little with the installation. Does the script still work in IE 7? If so, there is probably also an error in other browsers, you just aren't aware of it.

And the problem is probably actually with this preceding line:

var relattr=tablinks[i].getAttribute("rel")

which probably means that you either have a tablink in your HTML code with no rel, or have initialized out of order, perhaps even initialized once out of order and a second time in the correct place. But it could be something else.

Go back over the installation instructions and make sure you have followed them correctly.

If you want more help you could post the code to the page, though it may still be hard to pinpoint with only that. Best thing would be if you could put up a page somewhere on the web that demonstrates this issue and post a link to it here. It doesn't have to look good or even be a part of any site, just a single page that shows the problem.