Can some one help me please,
I am trying to use a javascript to create a table for user input, the number of rows in the table is controlled by the user through the input text box.
My problem is that when the user enters the number of lines required only the url gets the addition of the number entered, this is the code I am using.
What have I done wrong?
<html>
<head>
<script type="text/javascript">
function itemtable()
{
var a = document.numlines.number.value;
document.write.("<h1>Line Item Details</h1>");
document.write("The number is " +a+);
document.write("<table border=2 width=100%");
document.write("<tr>");
document.write("<th>Item No.</th><th>1</th><th>2</th><th>3</th>");
for (var i = 1; i <= a; i++ ) {
document.write("<tr>");
document.write("<td>"+i+"<td><input type=text name=item3"+i+"></td><td><input type=text name=item2"+i+"></td><td><input type=text name=item1"+i+"></td>");
document.write("</tr>");
}
document.write("</table>");
}
</script>
</head>
<body>
<form name="numlines">
<table border="2">
<tr>
<td><input type="text" value="" onchange="itemtable()" name="number">Number of lines required</td>
</tr>
</table>
</form>
</body>
</html>
Regards


Reply With Quote
Bookmarks