Jump to content

Simple Timing Problem


AudioWave

Recommended Posts

I'm having trouble using multiple simple timing operations in a function. Here is what I have:

<html><head><script type="text/javascript">function timeDisplay(){var t=setTimeout("document.write('H_')",100)var t=setTimeout("document.write('He_')",200)var t=setTimeout("document.write('Hel_')",300)var t=setTimeout("document.write('Hell_')",400)var t=setTimeout("document.write('Hello_')",500)}</script></head><body onload="timeDisplay()"></html>

The resultAs you see, it only performs the first simple timing operation, than infinitly tries to load the rest. How do I fix this bug?

Link to comment
Share on other sites

Your code didn't work because when 'H_' is written in your document, all your document has (including the source) is 'H_'. And 'H_' would obviously never manipulate anything.I found this out on:http://www.mozilla.org/docs/dom/domref/dom_shortIX.htmlmore precisely on:http://www.mozilla.org/docs/dom/domref/dom...52.html#1026254This worked in my firefox 1.0.7...

<html><head><script language="javascript" type="text/javascript">function escreve(string) {	ifram.document.open();	ifram.document.write(string);	ifram.document.close();}function timeDisplay(){	var t=setTimeout("escreve('H_');",100);	var t=setTimeout("escreve('He_');",200);	var t=setTimeout("escreve('Hel_');",300);	var t=setTimeout("escreve('Hell_');",400);	var t=setTimeout("escreve('Hello_');",500);}</script></head><body onLoad="timeDisplay();"><iframe src="about:blank" name="ifram" style="border: 0;"></iframe></body></html>

See this here: http://www.zanfranceschi.com.br/etc/hello_.html

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...