Hi,
I wrote the code to generate a new row each time when i press tab in the
second text box in a row of two text boxes. It's working fine. But my problem is
in the new row that is created when i press tab, the cursor should be in the first
text box. I wrote the code for that. It's line 10 and 11.
It's not working. Please let me know the solution.
More over when i press tab in the 2nd text box of first row the cursor is going to
second text box of second row and when i press tab from the second text box of
second row the cursor is not at all seen.
I spent a lot of time on this.
Thanks in advance.
The html file is below.
<html>
<head>
<script>
var numOfLines = 2;
function generateRow()
{
var d=document.getE lementById("div ");
d.innerHTML += "<input type='text' name='quantity" +numOfLines+"'>   ";
d.innerHTML += "<input type='text' name='itemCode" +numOfLines+"' onkeydown='if(e vent.keyCode==9 ){generateRow() ;}'><br>" ;
var felement = eval("document. forms[0].quantity"+numO fLines);
felement.focus( );
numOfLines += 1;
}
</script>
</head>
<body>
<form>
Quantity    ItemCode<br>
<input type=text name="quantity1 " >
<input type="text" name="itemcode1 " onkeydown="if(e vent.keyCode==9 ) {generateRow(); }">
<div id="div"></div>
</form>
<body>
</html>
I wrote the code to generate a new row each time when i press tab in the
second text box in a row of two text boxes. It's working fine. But my problem is
in the new row that is created when i press tab, the cursor should be in the first
text box. I wrote the code for that. It's line 10 and 11.
It's not working. Please let me know the solution.
More over when i press tab in the 2nd text box of first row the cursor is going to
second text box of second row and when i press tab from the second text box of
second row the cursor is not at all seen.
I spent a lot of time on this.
Thanks in advance.
The html file is below.
<html>
<head>
<script>
var numOfLines = 2;
function generateRow()
{
var d=document.getE lementById("div ");
d.innerHTML += "<input type='text' name='quantity" +numOfLines+"'>   ";
d.innerHTML += "<input type='text' name='itemCode" +numOfLines+"' onkeydown='if(e vent.keyCode==9 ){generateRow() ;}'><br>" ;
var felement = eval("document. forms[0].quantity"+numO fLines);
felement.focus( );
numOfLines += 1;
}
</script>
</head>
<body>
<form>
Quantity    ItemCode<br>
<input type=text name="quantity1 " >
<input type="text" name="itemcode1 " onkeydown="if(e vent.keyCode==9 ) {generateRow(); }">
<div id="div"></div>
</form>
<body>
</html>
Comment