Solved

Is innerHTML standards compliant?

Posted on 2008-06-19
4
196 Views
Last Modified: 2013-11-19
I read that innerHTML is "non W3C DOM" and I have no idea what that means....

http://www.javascriptkit.com/domref/elementproperties.shtml

Should I use this or is there a better method?  I want to alert the text found in a div.

My code works but I want to make sure it meets standards.
<div id="m52371426">Hello World</div>

<script type="text/javascript">

alert(document.getElementById("m52371426").innerHTML);

</script>

Open in new window

0
Comment
Question by:hankknight
  • 2
4 Comments
 
LVL 49

Expert Comment

by:Roonaan
ID: 21824521
Even when it is non W3C DOM about every major browser supports it. Why not use it?
0
 
LVL 7

Accepted Solution

by:
Zippit earned 300 total points
ID: 21824530
from www.w3schools.com:
http://www.w3schools.com/htmldom/dom_methods.asp

innerHTML is not a part of the W3C DOM specification. However, it is supported by all major browsers.
0
 
LVL 16

Author Comment

by:hankknight
ID: 21824581
Is there a W3C approved alternative?
0
 
LVL 49

Assisted Solution

by:Roonaan
Roonaan earned 200 total points
ID: 21824652
Probableto manually parse all childnodes...
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Preface This article introduces an authentication and authorization system for a website.  It is understood by the author and the project contributors that there is no such thing as a "one size fits all" system.  That being said, there is a certa‚Ķ
Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
The viewer will learn how to count occurrences of each item in an array.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now