子窗口给父窗口赋值 - 企业简介 - 南充市顺庆区小房子和树婚礼策划部
当前位置:首页 > 企业简介 >

子窗口给父窗口赋值

编辑:南充市顺庆区小房子和树婚礼策划部时间:2017-09-02 11:53:13阅读次数:2
子窗口给父窗口赋值 [javascript]

A页面<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>

[csharp]

<asp:TextBox ID="TextBoxAmount" runat="server" Enabled="false"></asp:TextBox>

<asp:Button ID="Button1" runat="server" Text="Call child window" OnClientClick="popUp('PageB.aspx')" />

B页面:

<script type="text/javascript">

function isNumeric(keyCode)

return ((keyCode >= 48 && keyCode <= 57)

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 ID="TextBoxqty" runat="server" onkeydown="return isNumeric(event.keyCode);" onpaste="return false;" Width="50"></asp:TextBox>

* 单价<asp:TextBox ID="TextBoxPrice" runat="server" onkeydown="return isNumeric(event.keyCode);" onpaste="return false;" Width="50"></asp:TextBox>

<asp:Button ID="Button1" runat="server" Text="Calculate" OnClientClick="calc()" />

,站群,采集软件

企业建站2800元起,携手武汉肥猫科技,做一个有见地的颜值派!更多优惠请戳:十堰SEO http://shiyan.4567w.com

上一篇:黄冈网站制作公司哪家好?首选肥猫科技027-82823488 下一篇:最后一页

相关阅读