我正在使用以下功能:
function GetRowValue(val) {
window.opener.document.getElementById("UniqueKeyField").value = val;
window.opener.__doPostBack();
window.close();
}
window.opener.__doPostBack 错误
并且即使我有window.Close()
函数弹出窗口也不会关闭。
最佳答案
一个选项是 session 变量。
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>
关于javascript - 我们如何使用 JavaScript 将值从 PopUpWindow 传递到 Aspx 页面?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35892328/