Jump to content

innerhtml


louandel

Recommended Posts

innerHTML is very much a web standard :)The innerHTML of an element is a property which contains all of the HTML inside the element.For example,<p>blahblahblah<b>blka</b></p>If you retrieved the innerHTML of the p element, you'd get:blahblahblah<b>blka</b>Hope that helps. :)Choco

Link to comment
Share on other sites

from http://developer.mozilla.org/en/docs/DOM:element.innerHTML

Though not actually a part of the W3C DOM specification, this property provides a simple way to completely replace the contents of an element. For example, the entire contents of the document body can be deleted by: document.body.innerHTML = ""; // Replaces body content with an empty string.The innerHTML property of many types of elements—including BODY or HTML—can be returned or replaced. It can be used to view the source of a page that has been modified dynamically: // Copy and paste into address bar as a single linejava script:x=document.body.innerHTML.replace(/</g,'<').replace(/\n/g,'<br>'); document.body.innerHTML = x;As there is no public specification for this property, implementations differ widely. For example, when text is entered into a text input, IE will change the value attribute of the input's innerHTML property but Gecko browsers do not. It should never be used to write parts of a table—W3C DOM methods should be used for that—though it can be used to write an entire table or the contents of a cell.
from http://www.webreference.com/js/tips/001209.html
The innerHTML property of elements in IE, is not part of the W3C DOM. Nevertheless, in response to customers' requests, Mozilla- and Gecko-based browsers (such as Netscape 6) decided to support it in builds dated May 19, 2000 or later (Mozilla M16 and later, Netscape 6 PR2 and later).
It cannot be guaranteed that every browser will support this property. It was (at least originally) limited to IE only
Link to comment
Share on other sites

innerHTML is very much a web standard :)The innerHTML of an element is a property which contains all of the HTML inside the element.For example,<p>blahblahblah<b>blka</b></p>If you retrieved the innerHTML of the p element, you'd get:blahblahblah<b>blka</b>Hope that helps. :)Choco
Yes thats moved me on choco. Thanks for answering. louandel
Thanks for that answer. Im geting the hang of it now. But it bothers me that it cant be used on all browsers.louandel
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...