ceema
03-02-2007, 11:38 AM
Hello all,
I have added new rows with text box in it with javascript. But I fail to get it's value from the script to my page wiht request.form. COuld any one help me? My code is
<SCRIPT LANGUAGE="JavaScript">
<!--
function rowcreation()
{
var gRowId = 2;
var tbody = document.getElementById('table1').getElementsByTag Name('tbody')[0];
var row = document.createElement('TR');
var cell1 = document.createElement('TD');
var cell2 = document.createElement('TD');
var cell3 = document.createElement('TD');
var inp1 = document.createElement('INPUT');
var inp2 = document.createElement('INPUT');
inp1.setAttribute('type','text');
inp1.setAttribute('value','New row');
inp1.setAttribute('id','t2');
cell1.innerHTML = gRowId;
cell2.appendChild(inp1);
row.appendChild(cell1);
row.appendChild(cell2);
row.appendChild(cell3);
tbody.appendChild(row);
gRowId++;
document.getElementById('hh').style.display = "none";
}
//-->
</SCRIPT>
<form id="Form1" method="post" runat="server" action="WebForm9.aspx">
<table id="table1">
<tbody>
<tr>
<td colspan="6"><a id="hh" href="javascript:rowcreation()" runat="server">test</a></td>
</tr>
<tr>
<td>first row</td>
<td>second row</td>
</tr>
<tr>
<td colspan="6"><input type="button" name="btn" id="btn" runat="server" value="btn"></td>
</tr>
</tbody>
</table>
</form>
I have added new rows with text box in it with javascript. But I fail to get it's value from the script to my page wiht request.form. COuld any one help me? My code is
<SCRIPT LANGUAGE="JavaScript">
<!--
function rowcreation()
{
var gRowId = 2;
var tbody = document.getElementById('table1').getElementsByTag Name('tbody')[0];
var row = document.createElement('TR');
var cell1 = document.createElement('TD');
var cell2 = document.createElement('TD');
var cell3 = document.createElement('TD');
var inp1 = document.createElement('INPUT');
var inp2 = document.createElement('INPUT');
inp1.setAttribute('type','text');
inp1.setAttribute('value','New row');
inp1.setAttribute('id','t2');
cell1.innerHTML = gRowId;
cell2.appendChild(inp1);
row.appendChild(cell1);
row.appendChild(cell2);
row.appendChild(cell3);
tbody.appendChild(row);
gRowId++;
document.getElementById('hh').style.display = "none";
}
//-->
</SCRIPT>
<form id="Form1" method="post" runat="server" action="WebForm9.aspx">
<table id="table1">
<tbody>
<tr>
<td colspan="6"><a id="hh" href="javascript:rowcreation()" runat="server">test</a></td>
</tr>
<tr>
<td>first row</td>
<td>second row</td>
</tr>
<tr>
<td colspan="6"><input type="button" name="btn" id="btn" runat="server" value="btn"></td>
</tr>
</tbody>
</table>
</form>