Solved

Is innerHTML standards compliant?

Posted on 2008-06-19
4
203 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

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL (http://www.experts-exchange.com/articles/201/Handling-Date-and-Time-in-PHP-and-MySQL.html) several years ago, it seemed like now was a good time to updat…
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

679 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