Flash Games
 FAQ   Search   Memberlist   Usergroups   Register  Profile   Log in to check your private messages   Log in 


Problem with document.write()



 

Post new topic   Reply to topic  
   DEVPPL Forum Index -> JavaScript Forum
View previous topic :: View next topic  
Author Message
DrAmbar



Joined: 04 Sep 2006
Posts: 2

PostPosted: Mon Sep 04, 2006 10:49 am    Post subject: Problem with document.write() Reply with quote

Hi,
I'm having trouble understanding the behaviour of the easiest of Javascript commands. Look at this htm file:

<HTML><HEAD>
<Script Language="JavaScript">
function Wrt()
{ document.write("Output of document.write"); }
</Script>
</HEAD><BODY>
<h2>Heading</h2>
<BUTTON onClick="Wrt();">TryIt</BUTTON>
</BODY></HTML>

If you try it out, the Output of document.write erases whatever else was already on the page (which was not the intention) and the mouse cursor shows the hourglass (busy indication) forever. However if the code is written without a button, like this:

<HTML><HEAD></HEAD>
<BODY>
<h2>Heading</h2>
<Script Language="JavaScript">
document.write("Output of document.write")
</Script>
</BODY></HTML>

It works okay.
Can someone tell me what is going on? Thanks in advance.

Ambar
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    DEVPPL Forum Index -> JavaScript Forum All times are GMT + 1 Hour
Page 1 of 1

 
 
Welcome to DEVPPL.com
You are not logged in, which means that you can't post in the forums.
Click here to Register

If you are a current member here on DEVPPL, please login below:

User: Pass:
Log me on automatically each visit:

 


Powered by phpBB © 2001, 2005 phpBB Group - Modified by DEVPPL

Flash Games - Sitemap