Chocolate570 Posted July 4, 2006 Share Posted July 4, 2006 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 More sharing options...
aspnetguy Posted July 4, 2006 Share Posted July 4, 2006 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 More sharing options...
scott100 Posted July 4, 2006 Share Posted July 4, 2006 You could use DOMSee this page for example to make a table with domhttp://developer.mozilla.org/en/docs/Trave..._DOM_Interfaces Link to comment Share on other sites More sharing options...
aspnetguy Posted July 4, 2006 Share Posted July 4, 2006 or you could make a wrppare element <body><div id="wrapper"></div></body> Then you could work with the wrapper.innerHTML Link to comment Share on other sites More sharing options...
scott100 Posted July 4, 2006 Share Posted July 4, 2006 Then you could work with the wrapper.innerHTML<{POST_SNAPBACK}> 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 More sharing options...
Webworldx Posted July 4, 2006 Share Posted July 4, 2006 What does your regular expression involve? Surely there's a better (neater/more efficient) way than executing it across the whole page? Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now