i'm having two forms-main form containing a html table and a button.on
clicking the button it pops up a child window containing a text box and a
button.afer entering some text in the text box and clicking the button the
child window is closed and a new row with the entered text should be added
in the main form table.I'm achieving this thru insertRow() function.i have
to raise the onclick event for that row thru javascript and on the click
event i have to call a function in the main form by passing arguments to
the function.the argument should be id of the newly created row.Everything
is working fine but while passing the id,the event is fired for the first
time itself and further clicks on that row does not raise the event ? how
can i achieve this ?
The sample code is provided below :
Test.jsp (main form)
<HTML>
<BODY>
<FORM method="post" name="Test" action="">
<center>
<table id="tab_test" border="1" width="100%">
<tr>
<td width="50%"> </td>
<td width="50%"> </td>
</tr>
<tr>
<td width="50%"> </td>
<td width="50%"> </td>
</tr>
</table>
</center>
</div>
<p><input type="button" value="Button" name="B3" onclick="clickMe()"></p>
<script language=JavaScript>
function clickMe() {
window.open("Sample.jsp?mode = xx","AddBuilds","height =
300,width=500,top=100,left=100,alwaysRaised=yes");
}
function callMe(rowid) {
alert(rowid);
alert("from main");
}
</script>
</FORM>
</BODY>
</HTML>
Sample.jsp
<HTML> <BODY>
<FORM method="post" name="Sample" action="">
<input type="button" value="Button" name="B3" onclick="clickMe()"></p>
<script language=JavaScript>
function clickMe() {
var newrow; newrow=parent.opener.document.getElementById
("tab_test").insertRow(1);
newrow.id="row1";
for (var i = 0; i < 2; i++) {
>v_newCell = newrow.insertCell(i);
v_newCell.innerHTML="XX";
}
newrow.onclick=parent.opener.callMe(newrow.id);//It works fine for the
very first time but fails to raise the on click event for further clicks
window.close();
}
</script>
</FORM>
</BODY>
</HTML>
Pl. provide the right solution
.