thedoggydog
thedoggydog

Reputation: 469

Slider Is Acting Funny

Ok so I have a slider that is not working. The first problem is when you click on the arrow buttons to go to the next slide I get these errors in my console.

Uncaught TypeError: Cannot call method 'getElementsByTagName' of null tabs.js:43
Uncaught TypeError: Cannot read property 'top' of null jquery.mCustomScrollbar.js:352
event.returnValue is deprecated. Please use the standard event.preventDefault() instead.
Uncaught TypeError: Cannot read property 'top' of null jquery.mCustomScrollbar.js:352
GET http://localhost/eclectogroove/undefined 404 (Not Found) jquery.min.js:127
GET http://localhost/eclectogroove/undefined 404 (Not Found) jquery.min.js:130
GET http://localhost/eclectogroove/undefined 404 (Not Found) jquery.min.js:130

I don't know why I am getting these errors but another problem is the image on the slider will randomly disappear after about 20 seconds.

Here is the code from tabs.js

init:function(tabid, dselected){
var menuitems=document.getElementById(tabid).getElementsByTagName("a")
this[tabid+"-menuitems"]=menuitems
for (var x=0; x<menuitems.length; x++){
    if (menuitems[x].getAttribute("rel")){
        this[tabid+"-menuitems"][x].hasSubContent=true
        if (menuscript.disabletablinks)
            menuitems[x].onclick=function(){return false}
    }
    else //for items without a submenu, add onMouseout effect
        menuitems[x].onmouseout=function(){this.className=""}
    menuitems[x].onclick=function(){menuscript.showsubmenu(tabid, this)}
    if (dselected=="auto" && typeof setalready=="undefined" && this.isSelected(menuitems[x].href)){
        menuscript.showsubmenu(tabid, menuitems[x])
        var setalready=true
    }
    else if (parseInt(dselected)==x)
        menuscript.showsubmenu(tabid, menuitems[x])
}

}

If you need me to post any code or supply you with any other information please let me know. Otherwise everything can be seen here.

Upvotes: 0

Views: 119

Answers (1)

stackErr
stackErr

Reputation: 4170

The problem is in your tabs.js file.

You are calling: menuscript.definemenu("albums", 0) (last line in the file) but there is no element with id albums.

This calls the init function and at line 43:

var menuitems=document.getElementById(tabid).getElementsByTagName("a") 

where var menuitems=document.getElementById(tabid) returns null. Hence the error Cannot call method 'getElementsByTagName' of null tabs.js:43

To solve this either create an element with id albums or just delete this: menuscript.definemenu("albums", 0)

FYI, get into the habit of ending a JS statement with a semicolon(;)...its very sloppy programming.

Upvotes: 1

Related Questions