Hi,
Code below dynamically adds an input box to a form, creating a new name
attribute as it goes... (many thanks to Martin Honnen for getting me this
far ;0) Problem is - in IE5.5 only the first form field (the hard-coded one)
is recovered from the form, while with Mozilla/Firefox all fields are.
The alert() just shows that the newly created element has no name in IE. Can
anyone offer help with this bizarre problem (I thought any old rubbish would
run in IE - even mine!)
Regards
Rae MacLeman
----------------------------------------------------------------------------
---------
<HTML>
<HEAD>
</HEAD>
<SCRIPT LANG=Javascript >
<!--
var gCount=1;
function DoChange() {
var objNewName, objBR;
gCount++;
objNewName = document.create Element('INPUT' );
objNewName.setA ttribute('NAME' , 'fname'+gCount) ;
alert('object name = '+objNewName.na me);
objNewName.setA ttribute('ID', 'name'+gCount);
objBR = document.create Element('BR');
document.getEle mentById("names ").appendChild( objNewName);
document.getEle mentById("names ").appendChild( objBR);
delete objNewName;
delete objBR;
}
//-->
</SCRIPT>
<BODY>
<form action="mozilla _test2_handler. asp" method="POST">
<div id="names" name="names">
<input id="fname1" name="fname1" type="text"><br >
</div>
<INPUT TYPE=button ONCLICK=DoChang e() VALUE='Add name'><input
type="submit"></form>
</BODY>
</HTML>
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.775 / Virus Database: 522 - Release Date: 10/8/04