W
webdev
Having done a bit more research, I stumbled across...
http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/ref
erence/methods/setattribute.asp
and made a slight change in case ... see below. This now works in both IE
and Mozilla... but I feel a bit uncomfortable not really understanding why.
Are there any further such problems downstream using these DOM methods with
IE?
Regards
Rae MacLeman
--------------------------------------
<HTML>
<HEAD>
</HEAD>
<SCRIPT LANG=Javascript>
<!--
var gCount=1;
function DoChange() {
var objNewName, objBR;
gCount++;
objNewName = document.createElement('INPUT');
objNewName.setAttribute('name', 'fname'+gCount); //changed 'NAME' to
'name'
alert('object name = '+objNewName.name);
objBR = document.createElement('BR');
document.getElementById("names").appendChild(objNewName);
document.getElementById("names").appendChild(objBR);
delete objNewName;
delete objBR;
}
//-->
</SCRIPT>
<BODY><form action="mozilla_test2_handler.asp" method="POST">
<div id="names" name="names">
<INPUT NAME="fname1" TYPE="text"><br>
</div>
<INPUT TYPE=button ONCLICK=DoChange() VALUE='Add name'><input
type="submit"></form>
</BODY>
</HTML>
http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/ref
erence/methods/setattribute.asp
and made a slight change in case ... see below. This now works in both IE
and Mozilla... but I feel a bit uncomfortable not really understanding why.
Are there any further such problems downstream using these DOM methods with
IE?
Regards
Rae MacLeman
--------------------------------------
<HTML>
<HEAD>
</HEAD>
<SCRIPT LANG=Javascript>
<!--
var gCount=1;
function DoChange() {
var objNewName, objBR;
gCount++;
objNewName = document.createElement('INPUT');
objNewName.setAttribute('name', 'fname'+gCount); //changed 'NAME' to
'name'
alert('object name = '+objNewName.name);
objBR = document.createElement('BR');
document.getElementById("names").appendChild(objNewName);
document.getElementById("names").appendChild(objBR);
delete objNewName;
delete objBR;
}
//-->
</SCRIPT>
<BODY><form action="mozilla_test2_handler.asp" method="POST">
<div id="names" name="names">
<INPUT NAME="fname1" TYPE="text"><br>
</div>
<INPUT TYPE=button ONCLICK=DoChange() VALUE='Add name'><input
type="submit"></form>
</BODY>
</HTML>