复制代码 代码如下:
<script type="text/javascript">
function popUp(url) {
objSubWin = window.open(url, "Popup", "toolbar=no,scrollbars=no,location=no,statusbar=no,menubar=no,resizable=0,width=300,height=80");
objSubWin.focus();
}
function SetValue(val) {
var amount = document.getElementById('<% = TextBoxAmount.ClientID %>');
amount.value = val;
}
</script>
复制代码 代码如下:
Amount:
<asp:TextBox runat="server" Enabled="false"></asp:TextBox>
<asp:Button runat="server" Text="Call child window" OnClientClick="popUp('PageB.aspx')" />
复制代码 代码如下:
<script type="text/javascript">
function isNumeric(keyCode) {
return ((keyCode >= 48 && keyCode <= 57) || keyCode == 8)
}
function calc() {
if (window.opener != null && !window.opener.closed) {
var qty = document.getElementById('<% = TextBoxqty.ClientID %>');
var price = document.getElementById('<% = TextBoxPrice.ClientID %>');
window.opener.SetValue(parseInt(qty.value) * parseInt(price.value));
}
}
</script>
复制代码 代码如下:
数量<asp:TextBox runat="server" onkeydown="return isNumeric(event.keyCode);" onpaste="return false;"></asp:TextBox>
* 单价<asp:TextBox runat="server" onkeydown="return isNumeric(event.keyCode);" onpaste="return false;"></asp:TextBox>
<asp:Button runat="server" Text="Calculate" OnClientClick="calc()" />
新闻热点
疑难解答
图片精选