[Javascript] A loop for this script? Is it really possible?
Roland Dong
rdong at advance.net
Tue Jul 5 11:37:35 CDT 2005
Is it possible to pass the value to:
document.getElementById(value_to_be_passed).onmouseover=function(){....}
I tried many tricks without success. I started wondering if it is really
possible. I do not understand why it works if you hard coded value:
Document.getElementById("tutorials").onmouseover=function(){....} but you
can never replace "tutorials" with any dynamic value? I even tried
f="tutorial";
Document.getElementById(f)onmouseover=function(){....} but it is still not
working. That drives me nut!
>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)
More information about the Javascript
mailing list