Hi
I'm writing text boxes to a page dynamically using the following function:
<html>
<head>
<script language="javascript">
function AddTextFields(num)
{
data = "";
data = "<table border=1 width='80%' cellpadding='0' cellspacing='0'>"
+ "<tr><th align='left' bgcolor= '#6699ff' width='20%'>Parameter No.</th>"
+ "<th align='left' bgcolor= '#6699ff' width='40%'>Parameter Name</th>"
+ "<th align='left' bgcolor= '#6699ff' width='40%'>Parameter Value</th></tr>";
for (i=1; i<=num; i++) {
data = data + "<tr><td><input type='text' size='20%' align='left' id='text'1 name='text'1></td>"
+ "<td><input type='text' size='40%' align='left' id='text'1 name='text'1></td>"
+ "<td><input type='text'size='40%' align='left' id='text'1 name='text'1></td></tr>";
}
data = data +"</table>";
layerWrite("AddParameter",null,data)
AddParameter.innerHTML=data;
}
</script>
</head>
<body>
<form>
<span id="AddParameter"></span>
</form>
</body>
</html>
The function takes an argument num which is the number of textboxes.
this works fine but i need to populate the text boxes with different text values. Now since the text boxes a re in a loop how would i pass different values each time.
Please help
s-)
I'm writing text boxes to a page dynamically using the following function:
<html>
<head>
<script language="javascript">
function AddTextFields(num)
{
data = "";
data = "<table border=1 width='80%' cellpadding='0' cellspacing='0'>"
+ "<tr><th align='left' bgcolor= '#6699ff' width='20%'>Parameter No.</th>"
+ "<th align='left' bgcolor= '#6699ff' width='40%'>Parameter Name</th>"
+ "<th align='left' bgcolor= '#6699ff' width='40%'>Parameter Value</th></tr>";
for (i=1; i<=num; i++) {
data = data + "<tr><td><input type='text' size='20%' align='left' id='text'1 name='text'1></td>"
+ "<td><input type='text' size='40%' align='left' id='text'1 name='text'1></td>"
+ "<td><input type='text'size='40%' align='left' id='text'1 name='text'1></td></tr>";
}
data = data +"</table>";
layerWrite("AddParameter",null,data)
AddParameter.innerHTML=data;
}
</script>
</head>
<body>
<form>
<span id="AddParameter"></span>
</form>
</body>
</html>
The function takes an argument num which is the number of textboxes.
this works fine but i need to populate the text boxes with different text values. Now since the text boxes a re in a loop how would i pass different values each time.
Please help
s-)