[Javascript] A loop for this script?

Roland Dong rdong at advance.net
Sat Jul 2 12:32:27 CDT 2005


> -----Original Message-----
> From: javascript-bounces at LaTech.edu [mailto:javascript-bounces at LaTech.edu]
> On Behalf Of Andrew Clover
> A quick fix would be to precalculate the id and put it in the string:
> 
>    var id= ids[i];
>    var f= 'document.getElementById("'+id+'").style.visibility= "hidden"';
>    var timer= window.setTimeout(f, 500)
> 


Andrew,

Thanks for your reply. Actually, Mckinney provided the similar solution a
few days ago.  The real problem is that I can not pass the value of id to 
getElementById() in the following code:

========================================================================
document.getElementById("'+id+'").onmouseover=function(){
	clearTimeout(TIMER);
document.getElementById("'+id+'").style.visibility="visible";
}
	   	    
document.getElementById("'+id+'").onmouseout=function(){
TIMER=setTimeout('document.getElementById("'+id+'").style.visibility="
hidden"', 500);
}

============================================================================
It complains that  "document.getElementById("'+id+'") has no properties"

This is where I got stuck.  This is the link to the complete code:
http://www.wiu.edu/users/murbhd/test.html


Thanks








More information about the Javascript mailing list