Help - Search - Member List - Calendar
Full Version: The pause that doesn't
WorkTheWeb Forums > Webmaster Resources > JavaScript Help
Support our Sponsors!
I was looking around for some code for a special purpose and found
this. Seems it should print "here we go" , pause 5 seconds, print "now
we are back". Instead, it pauses 5 seconds before printing both lines
with no pause between. Can someone please explain why it behaves that
way. I know in the case of "setTimeout" the only thing affected is the
function, etc. appearing as "setTimeout" arguments. But, this is just
straight code.

<body>
<script language='javascript'>
document.write('here we go<br>');
pausecomp(5000);
document.write('now we are back');

function pausecomp(Amount)
{
d = new Date() //today's date
while (1<2)
{
mill=new Date() // Date Now
diff = mill-d //difference in milliseconds
if( diff > Amount ) {break;}
}
}
</script>

</body>

Ganesh
Where to find a right sided slide-in JavaScript?

My idea is something like this
http://www.dynamicdrive.com/dynamicindex1/davidmenu.htm

But I need it right-sided, not left-sided...

tia


PHP Help | Linux Help | Web Hosting | Reseller Hosting | SSL Hosting
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2006 Invision Power Services, Inc.