L
Laser Lips
Hello.
I need to change the name of a form element(s) after the HTML has
loaded and I can do it in FireFox but not in IE.
Here is a small snippet of code.
<HEAD>
<BODY>
<input type='text' id='test' name='useName'/>
<script type='text/javascript'>
var el=document.getElementById("test");
alert(el);
var els=document.getElementsByName("useName");
//alert should output 1
alert(els.length);
//trying two ways to set the attribute
el.setAttribute("name","graham");
el.name="graham";
var els=document.getElementsByName("graham");
//FireFox outputs 1, but IE outputs 0
alert(els.length);
</script>
</BODY>
</HTML>
I need to change the name of a form element(s) after the HTML has
loaded and I can do it in FireFox but not in IE.
Here is a small snippet of code.
<HEAD>
<BODY>
<input type='text' id='test' name='useName'/>
<script type='text/javascript'>
var el=document.getElementById("test");
alert(el);
var els=document.getElementsByName("useName");
//alert should output 1
alert(els.length);
//trying two ways to set the attribute
el.setAttribute("name","graham");
el.name="graham";
var els=document.getElementsByName("graham");
//FireFox outputs 1, but IE outputs 0
alert(els.length);
</script>
</BODY>
</HTML>