[thelist] Welcome to the "thelist" mailing list

Kowalkowski, Lee (ASPIRE) lee.kowalkowski at hmrcaspire.com
Fri Nov 18 03:25:20 CST 2005


> yan zhihong wrote:
> 
>  var ll=0;
>  function test() {
>   while(ll==1){}
>   setsource1("a.html");
>   ll=1;
>   while(ll==1){}
>   setsource1("b.html");
>   ll=1;
>   while(ll==1){}
>   setsource1("c.html");
>  }
> 

Woah!  This will simply block all events.   Setting II to 1 followed by
while(II==1){} will never yield to another event.  You must stick to an
event-driven design (without polling in loops).

Something like:

	var pages = new Array("a.html", "b.html", "c.html");
	var currentPage = 0;

	function test()
	{
		setsource1(pages[currentPage]);
		currentPage++;
	}

Obviously the test() function above needs to be more robust, checking for
end of array and perhaps decoupling the onload event once you've reached the
end of the array or whatever you want to do.  I'm sure you can figure that
out.

- LK


===========================================================
Our e-mail domain has now changed from iraspire.com to hmrcaspire.com. Please update your address books.
===========================================================




More information about the thelist mailing list