![](/img/trans.png)
[英]How to pass javascript variable value from .aspx page to .ashx page
[英]How Can We Pass a Value From PopUpWindow to Aspx Page using JavaScript?
我使用以下功能:
function GetRowValue(val) {
window.opener.document.getElementById("UniqueKeyField").value = val;
window.opener.__doPostBack();
window.close();
}
window.opener.__doPostBack error
,即使我有window.Close()
函數,彈出窗口也沒有關閉。
一種選擇是會話變量。
function GetRowValue(val) {
var uniqueKey = window.opener.document.getElementById("UniqueKeyField").value;
//ASP code here for assigning Javascript var to session var
'<%Session["UniqueKey"] = "' + uniqueKey + '"; %>';
window.close();
}
使用Javascript提取變量(如果需要)
<script type="text/javascript">
function GetUniqueKey()
{
var uniqueKey = '<%= Session["UniqueKey"] %>';
}
</script>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.