W
webdev
Hi,
I'm writing an extensible form - it contains one name field to start and an
"Add another name" button, so you can add as many bnames as required and
then submit the form. Sounds simple and I have it working in IE5.5, but it
doesn't retain the data input to the form when run in Firefox. can anyone
please point me in the right direction? Code shown below...
Thanks in advance
Rae MacLeman
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Test Form</title>
<script language="JavaScript" type="text/javascript">
gCount = 1;
function addName(){
var el;
gCount++;
el = document.getElementById("myDiv");
el.innerHTML = el.innerHTML + "Enter Name : <input type='text'
name='fld"+gCount+"' id='fld" + gCount+"' size='10'><br>"
}
</script>
</head>
<body>
<form name="testform" id="testform">
<div id="myDiv">
Enter Name : <input type="text" name="fld1" id="fld1" size="10"><br>
</div>
</form>
<a href="javascript:addName();">Add another name field</a>
</body>
</html>
I'm writing an extensible form - it contains one name field to start and an
"Add another name" button, so you can add as many bnames as required and
then submit the form. Sounds simple and I have it working in IE5.5, but it
doesn't retain the data input to the form when run in Firefox. can anyone
please point me in the right direction? Code shown below...
Thanks in advance
Rae MacLeman
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Test Form</title>
<script language="JavaScript" type="text/javascript">
gCount = 1;
function addName(){
var el;
gCount++;
el = document.getElementById("myDiv");
el.innerHTML = el.innerHTML + "Enter Name : <input type='text'
name='fld"+gCount+"' id='fld" + gCount+"' size='10'><br>"
}
</script>
</head>
<body>
<form name="testform" id="testform">
<div id="myDiv">
Enter Name : <input type="text" name="fld1" id="fld1" size="10"><br>
</div>
</form>
<a href="javascript:addName();">Add another name field</a>
</body>
</html>