Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Javascript document object writes in a new page?

 
pawan chopra
Ranch Hand
Posts: 417
jQuery Mac Objective C
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?

 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 417
jQuery Mac Objective C
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
circle.jpg
[Thumbnail for circle.jpg]
moving circle
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64970
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
http://www.ajaxload.info/

Eric
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic