Jump to content

Replacing Body innerHTML


Chocolate570

Recommended Posts

I have a regular expression. Now what I want to do is execute the expression upon my document's body innerHTML. How would I do this in a crossbrowser way?I was going to use document.body.innerHTML, but this takes some time, and also is not supported accross all browsers. What to do?Thanks.Choco

Link to comment
Share on other sites

what browsers do not support document.body.innerHTML?I tested this in IE,FF, and Opera and it worked fine.

  onload=  function()  {  	var contents = document.body;  	contents.innerHTML = "I changed the contents! :P";  }

Link to comment
Share on other sites

Then you could work with the wrapper.innerHTML

Yeah although dom is a w3 recommendation, innerHTML is supported by most/all browsers and is faster.If i was writing to the body with innerHTML i would also write to a div in the body, not the body its self :)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...