f



Missing text

I have a small code.  It does not print the word "hi".  Why?

<HEAD>
<SCRIPT language=JavaScript>
function listnum() {
i=0
	do { 		
	document.write( i + "<br>")
	i++
	} while(i<10)
}</SCRIPT>	
	</HEAD>

<BODY onload=listnum()>
hi
</BODY>

Thank you.
0
yma
9/12/2003 7:04:37 PM
comp.lang.javascript 38370 articles. 2 followers. javascript4 (1315) is leader. Post Follow

4 Replies
391 Views

Similar Articles

[PageSpeed] 31

chirs wrote on 12 sep 2003 in comp.lang.javascript:

> I have a small code.  It does not print the word "hi".  Why?
> 
> <HEAD>
> <SCRIPT language=JavaScript>
> function listnum() {
> i=0
>      do {           
>      document.write( i + "<br>")
>      i++
>     } while(i<10)
>}</SCRIPT>     
>      </HEAD>
> 
> <BODY onload=listnum()>
> hi
> </BODY>
> 
> Thank you.
> 

Because you cannot do a document.write on a page without destroying the 
page that was there before.


-- 
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
0
Evertjan
9/12/2003 7:17:39 PM
On 12 Sep 2003 19:17:39 GMT, "Evertjan."
<exjxw.hannivoort@interxnl.net> wrote:

>chirs wrote on 12 sep 2003 in comp.lang.javascript:
>
>> I have a small code.  It does not print the word "hi".  Why?
>> 
>> <HEAD>
>> <SCRIPT language=JavaScript>
>> function listnum() {
>> i=0
>>      do {           
>>      document.write( i + "<br>")
>>      i++
>>     } while(i<10)
>>}</SCRIPT>     
>>      </HEAD>
>> 
>> <BODY onload=listnum()>
>> hi
>> </BODY>
>> 
>> Thank you.
>> 
>
>Because you cannot do a document.write on a page without destroying the 
>page that was there before.
>
>
>-- 
>Evertjan.
>The Netherlands.
>(Please change the x'es to dots in my emailaddress)

NOT quite true!  Try this:
<html>
<head><script language="JavaScript">
function listnum() {
i=0
	do { 		
	document.write( i + "<br>")
	i++
	} while(i<10)
}</script>
</head>
<body>
<p>hi </p>
<script language="JavaScript">
listnum()
</script>
<p>AND hi AGAIN....</p>
</body>
</html>



Dave Walker

For PHP and MySQL demo try here:
  http://www.thedemosite.co.uk  -- hey its free.
Seiretto for Hosting Solutions that Work.
  http://www.Seiretto.com  
0
sales
9/12/2003 9:09:15 PM
sales@nospammers-seiretto.com writes:

> On 12 Sep 2003 19:17:39 GMT, "Evertjan."
> <exjxw.hannivoort@interxnl.net> wrote:

> >Because you cannot do a document.write on a page without destroying the 
> >page that was there before.

> NOT quite true!

Correct. The quite true version is:

Because you cannot do a document.write on a page that has finished
loading, without destroying the page that was there before.
 
/L
-- 
Lasse Reichstein Nielsen  -  lrn@hotpop.com
 Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit.html>
  'Faith without judgement merely degrades the spirit divine.'
0
Lasse
9/12/2003 9:14:36 PM
 wrote on 12 sep 2003 in comp.lang.javascript:

>>Because you cannot do a document.write on a page without destroying the 
>>page that was there before.
> 
> NOT quite true!  Try this:
> 

I should have said:

"on a page that is finished"


-- 
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
0
Evertjan
9/12/2003 9:51:13 PM
Reply: