louandel Posted November 22, 2006 Share Posted November 22, 2006 Very simply what is innerhtml , what is it used for, and how is it used with javasceript?thanxlouandel Link to comment Share on other sites More sharing options...
aalbetski Posted November 22, 2006 Share Posted November 22, 2006 I believe this is a Microsoft extension to the HTML DOM and is not a standard across all browers.http://msdn.microsoft.com/library/default....s/innerHTML.asp Link to comment Share on other sites More sharing options...
Chocolate570 Posted November 22, 2006 Share Posted November 22, 2006 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 More sharing options...
aalbetski Posted November 22, 2006 Share Posted November 22, 2006 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.htmlThe 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 More sharing options...
louandel Posted November 22, 2006 Author Share Posted November 22, 2006 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. :)ChocoYes thats moved me on choco. Thanks for answering. louandelfrom http://developer.mozilla.org/en/docs/DOM:element.innerHTML 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 More sharing options...
Webworldx Posted November 22, 2006 Share Posted November 22, 2006 You should find any new browser supports it fine, it's just the older ones like the previous explorer mac's that have problems with it. Link to comment Share on other sites More sharing options...
Chocolate570 Posted November 22, 2006 Share Posted November 22, 2006 And almost no one uses explorer mac, so you can warn them if they are that your site wont work well. Link to comment Share on other sites More sharing options...
aspnetguy Posted November 22, 2006 Share Posted November 22, 2006 Personally I only support IE6+, FF 1.5+, Opera 9, and Safari. Other than that those 3-5% are on their own! 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