By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,567 Members | 1,670 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,567 IT Pros & Developers. It's quick & easy.

Missing text

P: n/a
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.
Jul 20 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
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)
Jul 20 '05 #2

P: n/a
On 12 Sep 2003 19:17:39 GMT, "Evertjan."
<ex**************@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
Jul 20 '05 #3

P: n/a
sa***@nospammers-seiretto.com writes:
On 12 Sep 2003 19:17:39 GMT, "Evertjan."
<ex**************@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 - lr*@hotpop.com
Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #4

P: n/a
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)
Jul 20 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.