Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Object Required runtime error

Status
Not open for further replies.

NetworkGhost

IS-IT--Management
Apr 12, 2005
1,324
US
Getting a Object Required runtime error for my jscript in IE


When I debug the terminal points to:

idhead.style.display = 'none'

Everything works ok, just dont want the broswer throwing errors. ANyone have any ideas?


Here is my code:

function tabshow(tabid) {
var objID = "tabid"
if (tabid != '') {

var show = document.getElementById(tabid)
var objID= "link_" + tabid
var head = document.getElementById(objID)

}
for (i=0; i <= 10; i++) {
var tab_id = 'tab' + (i + 1)
var link_id = 'link_' + tab_id
var idhead = document.getElementById(tab_id)
var lclass = document.getElementById(link_id)
if (tabid != tab_id) {
idhead.style.display = 'none'
lclass.className = ''
} else {
idhead.style.display = 'block'
lclass.className = 'active'
}
}

}
function steps(stepid) {
var objID = "stepid"
if (stepid != '') {
var hide = [document.getElementById(stepid)]
var objID= "link_" + stepid
var head = document.getElementById(objID)
}
for (i=0; i<hide.length; i++) {
if (hide.style.display == 'none') {
hide.style.display = 'block'
head.innerHTML = head.innerHTML.replace("[+]","[-]")

} else {
hide.style.display = 'none'
head.innerHTML = head.innerHTML.replace("[-]","[+]")
}

}



}


Free Firewall/Network/Systems Support-
 
Thanks. So now I guess I will just hide the error from the user:

onerror=handleErr

function handleErr(msg,url,l)
{
return true
}

Any idea why its giving an error though?

Free Firewall/Network/Systems Support-
 
Do you have 11 elements with the ID starting with "tab"? After this line:

Code:
var idhead = document.getElementById(tab_id)

add this:

Code:
alert(idhead);

to see if all the elements exist.

Lee
 
Those are the only lines above:

function tabshow(tabid) {
var objID = "tabid"
if (tabid != '') {

var show = document.getElementById(tabid)
var objID= "link_" + tabid
var head = document.getElementById(objID)

}
for (i=0; i <= 10; i++) {
var tab_id = 'tab' + (i + 1)
var link_id = 'link_' + tab_id

Free Firewall/Network/Systems Support-
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top