Click here to Skip to main content
15,069,020 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
hi the code shows the output of both within the document.write("Welcome to my world!!!
")and outside (Enjoy your stay...) its prints both
what is the difference of that

What I have tried:

<Html> <head> <title>my javascript page</title> </head>  <body> hello! ! ! <Br> <script> document.write("welcome to my world! ! ! <Br>"); </script> enjoy your stay...<br> </body> </HTML>

Welcome to my world!!!
Enjoy your stay...
Updated 28-Nov-17 0:52am
Richard MacCutchan 28-Nov-17 6:52am
Please do not put your test code as the question title.

1 solution

No difference, it is doing what you coded. The text in HTML tags is on the page, and the text in the script is added when the script runs. In your case the script will run when the page is loaded. See HTML Tutorial[^] for further information.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900