Version2 - Just for a change... this doesn't work in IE.. but does in Mozilla!

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>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,996
Messages
2,570,238
Members
46,826
Latest member
robinsontor

Latest Threads

Top