ga15859
09-14-2004, 12:32 PM
All,
In Internet Explorer, I can assign arbitrary attributes inside of the HTML for an input tag, like this:
<input type="text" name="MyField" myValue="3">
And can then access it like this:
alert(document.getElementById("MyField").myValue);
Although I know the immediate argument is "that's no longer valid HTML", I have found that the ability to stick arbitrary attributes into the field has quite a few advantages.
In Netscape, it appears that any attribute it is unaware of (e.g., myValue), it ignores when processing the tag. However, I can access the field via the DOM, and then set that attribute myself. For my purposes, I want to be able to write out the tag containing custom properties, and be able to access said custom properties via the DOM from that point.
Does anyone know how to get this to work in Netscape 7.x?
In Internet Explorer, I can assign arbitrary attributes inside of the HTML for an input tag, like this:
<input type="text" name="MyField" myValue="3">
And can then access it like this:
alert(document.getElementById("MyField").myValue);
Although I know the immediate argument is "that's no longer valid HTML", I have found that the ability to stick arbitrary attributes into the field has quite a few advantages.
In Netscape, it appears that any attribute it is unaware of (e.g., myValue), it ignores when processing the tag. However, I can access the field via the DOM, and then set that attribute myself. For my purposes, I want to be able to write out the tag containing custom properties, and be able to access said custom properties via the DOM from that point.
Does anyone know how to get this to work in Netscape 7.x?