Dear Sir,
The following code is to dynamically generate textbox. But I met some problems when running the javascript code:
d.innerHTML+=form.dir.options[form.dir.selectedIndex].value;
What’s the problem ?
<html>
<head>
<title></title>
<script>
function generateRow(form)
{
var d=document.getElementById(“div”);
d.innerHTML+=form.dir.options[form.dir.selectedIndex].value;
d.innerHTML+=”<input type=’text’ name=’itemCode’ size = ‘5’><br>” ;
}
</script>
</head>
<body>
<table BORDER=1 CELLSPACING=0 CELLPADDING=3 align=center width=600 bordercolorlight=#99FF99>
<td align = center width = ‘300’>
<div id=”div”></div>
</td>
<td>
<form name = “mydir”>
<div style=”position:absolute;left: 600; top: 0″>
<select name = “dir”>
<option>11</option>
<option>22</option>
</select>
<input type=”button” value=”新增欄位” onclick=”generateRow(this.form)”>
<Input type = “Submit” Name = “儲存” value = “儲存” >
</form>
</td>
</table>
</body>