I am trying to use setTimeout with a function that has a parameter and I keep getting the error message theitem has no properties.
I am presently working on windows xp pro with Firefox as my browser.
[CODE=javascript]
previous = "";
previousmenuite m = "";
function removeitem (theitem) {
alert(theitem);
theitem.style.d isplay= "none";
}
function displaymenu(mea ltype)
{
if (mealtype)
{
if (previous != "")
for (i=document.get ElementById(pre vious).getEleme ntsByTagName('d iv').length-1; i >= 0;i--)
//setTimeout("tim eout3("+param+" )", 5000);
//setTimeout(func tion(){theFunct ion(p1,p2,p3);} , ms);
setTimeout(func tion() {removeitem(doc ument.getElemen tById(previous) .getElementsByT agName('div')[i]);}, 1000);
number = document.getEle mentById(mealty pe).getElements ByTagName('div' ).length;
for (i=0; i < number;i++)
document.getEle mentById(mealty pe).getElements ByTagName('div' )[i].style.display= "block";
previous=mealty pe;
}
}
[/CODE]
Again, the error code is theitem has no properties
Thanks in advance,
Terry
I am presently working on windows xp pro with Firefox as my browser.
[CODE=javascript]
previous = "";
previousmenuite m = "";
function removeitem (theitem) {
alert(theitem);
theitem.style.d isplay= "none";
}
function displaymenu(mea ltype)
{
if (mealtype)
{
if (previous != "")
for (i=document.get ElementById(pre vious).getEleme ntsByTagName('d iv').length-1; i >= 0;i--)
//setTimeout("tim eout3("+param+" )", 5000);
//setTimeout(func tion(){theFunct ion(p1,p2,p3);} , ms);
setTimeout(func tion() {removeitem(doc ument.getElemen tById(previous) .getElementsByT agName('div')[i]);}, 1000);
number = document.getEle mentById(mealty pe).getElements ByTagName('div' ).length;
for (i=0; i < number;i++)
document.getEle mentById(mealty pe).getElements ByTagName('div' )[i].style.display= "block";
previous=mealty pe;
}
}
[/CODE]
Again, the error code is theitem has no properties
Thanks in advance,
Terry
Comment