ASP怎样把父窗口的变量传给子窗口

ASP怎样把父窗口的变量传给子窗口,第1张

function ButtonClick()

{

window.open("Buy.asp?id=2","a", "height=350, width=400, top=0, left=0, toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, status=no")

}

用传值来进行 *** 作 。

可以用页面后加 ?变量名=值,比如 aaa.asp?id=1000

在子页面中就用 a=request("id")

可以用客户端全局变量 session("id"),这样是全局的,任何页面都可以用session("id")了

在本页中加入脚本

<script language="javascript" type="text/javascript">

function ScanMessageDetail(messageId)

{

if(window.showModalDialog("testclose.aspx?messageid="+messageId,"","status=nodialogWidth=800pxdialogHeight=500pxmenu=noresizeable=yesscroll=yescenter=yesedge=raise")=="OK")

{

document.location.href = "DataListTest.aspx"

}

}

</script>

在后台中注册脚本

protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)

{

if (e.Row.RowType == DataControlRowType.DataRow)

{

e.Row.Attributes.Add("onclick", "ScanMessageDetail(4939)")

}

}

在目标页的关闭按钮

<input id="Button1" type="button" value="关闭" onclick="javascript:window.returnValue='OK'self.close()"/>


欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/sjk/6691873.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2023-03-26
下一篇2023-03-26

发表评论

登录后才能评论

评论列表(0条)

    保存