Entry
In IE5 I could add user defined attributes to HTML TAGS. i.e. <INPUT type=text name=afieldname formattye=1001> can this be done in NS6?
Feb 16th, 2001 09:16
Mike Hall, brian corry,
Yes, the W3C DOM provides a method. Given this HTML:
<div id="myDiv" myAttribute="myValue">Some text.</div>
You can find the attribute value in IE 5 or NS 6 like this:
var el = document.getElementById("myDiv");
alert(el.getAttribute("myAttribute"));
You can also use the element's attributes array.
The source link above points to a utility script I've developed that
will let you browse the DOM structure of a page. It can be to run with
both IE 5 and Netscape 6 against the same page to see how they differ.