I have tried to use the following code to passing value back from the child window back to the parent window
<tr>
<th class="clLabel">Unit</th>
<td>
<asp:TextBox ID="sUnit" runat="server" MaxLength="12" Width="3em" />
</td>
</tr>
<script type="text/javascript">
$("#test").click(function () {
var parent = $(parent.document.body);
$(parent).find('input#sUnit').val("test");
window.close();
});
</script>
But some how error message always display when it's come to this code of line
NOTE: parent page and the child page is holding in the difference host (will this cause the problem?)
Does anyone know what is it going on? A开发者_如何学运维nd how can I solve it?
Guess this will work.
<script>
$(function (){
$("#test").click(function () {
var parent = window.opener.document;
$(parent).find('input#sUnit').val("test");
window.close();
});
})
</script>
<a href="#" id="test">test</a>
UPDATE
the opender Script
<input type="button" onclick="window.open('search.php', '_blank', 'height=200, width=300');" value="launch!" />
<input id="sUnit" value="" type="text"/>
精彩评论