July 2nd in Javascript by pbu .

how to change div content in javascript?

how to change div content in javascript?

Its very easy to change the contents of div in javascript. Just get the object of div using getElemementbyID() or getElementbyName() and use innerHTML property with the new value.

divObj = document. getElementbyID("mydiv");
divObj.innerHTML = '<p>This is a html code</p>';

One important thing to note is, your div should have loaded after all the images. If not it wont work.

Similar Posts:

Share and Enjoy:
  • del.icio.us
  • digg
  • StumbleUpon
  • Technorati
  • DZone
  • Facebook
  • FriendFeed
  • Reddit
  • RSS
  • Twitter

Leave A Comment.