Links

Lists

Latest Updates

Ruby On Rails List
Python list
Advanced Java
The JavaScript List
Apache Users
Full Disclosure
Linux Security

Search the archives!


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Javascript] how to work around this?


  • From: rdong at advance.net (Roland Dong)
  • Subject: [Javascript] how to work around this?
  • Date: Wed Jun 29 22:50:31 2005

I can only get the last loop result with the following script. How to work
around this?  From Andrew's explanation that this is caused by late
evaluation.   Please throw some light on this.

Thanks you.

==================================================
<script type="text/javascript">

startList = function(){

navBar = document.getElementById("nav").rows[0].cells;
var i=0;
for ( x in dthmlNav){

  navBar[i].onmouseover=function() {
		   document.getElementById(x).style.visibility="visible"
  }

  navBar[i].onmouseout=function() {
	
TIMEOUT_ID=setTimeout('document.getElementById(x).style.visibility="hidden"'
, 500);
  }

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