File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes HTML, CSS and JavaScript and the fly likes Javascript document object writes in a new page? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Javascript document object writes in a new page?" Watch "Javascript document object writes in a new page?" New topic
Author

Javascript document object writes in a new page?

pawan chopra
Ranch Hand

Joined: Jan 23, 2008
Posts: 410

I have this code when I am clicking on the button it writes hello but it removes button from the html page. Can any body tell me the reason and how to avoid this?



Pawan Chopra
SCJP - DuMmIeS mInD
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
You can not use document.write after the page loads. It replaces he content of the page when you do that.

If you want to add text to the page after it loads, you need to use innerHTML or appendChild.

Eric
pawan chopra
Ranch Hand

Joined: Jan 23, 2008
Posts: 410

Thanks alot innerHTML worked for me! One more thing can you please guide me while in waiting stage how can i show a moving circle(as shown in attachment) using javascript. I hope this is possible using javascript.



[Thumbnail for circle.jpg]

Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61206
    
  66

Easy. Creating an animated GIF for your "moving circle", place it where you want it to show up, and hide it using the CSS display property.

When you want it to show up, use JavaScript to modify the CSS to make it show up.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
http://www.ajaxload.info/

Eric
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Javascript document object writes in a new page?