关于关闭弹出窗口,并且父窗体跳转页面的问题
现有以项目3个页面
1.aspx有一图片 点击js
<script language="javascript">
function openuser1() {
var gvtable = document.getElementById('GridView1');
var counter = 0;
var username = "";
for (var i = 1; i < gvtable.rows.length; i++) {
var cb = gvtable.rows(i).cells(0).children(0);
if (cb.checked)
{
username = gvtable.rows(i).cells(1).innerText;
counter++;
}
}
if (counter == 1)
{
window.showModalDialog("EmpSelect.aspx?user=" + username + " ", "window", "dialogWidth:650px;DialogHeight=580px;status:yes;scroll=yes;help:yes'");
//window.location = "Employee_show.aspx?id="+id()+"&key=1";
//showwait();
}
else
{
alert('请选择查看人员(且只能选择一人)');
return false;
}
}
</script>
弹出页面EmpSelect.aspx?user=XXX窗口中有写选项 确定后关闭 并且让a.aspx父页面跳转
empselect.aspx页面中button事件
this.Response.Write("<script language=javascript>window.opener=null;window.close();window.parent.location = 'Employee_show.aspx?id=" + Username + "&key=1&list=" + id + "';</script>");
带参数跳转 请问如何实现?
a页面点击图片,js带参数弹新窗b页面,b页打开并接收参数 确定后关闭b页面 并带参数另 a页面跳转到指定页面
------解决方案--------------------1.aspx 的js中那段 if (counter == 1)那里改成:
if (counter == 1)
{
var dlg = window.showModalDialog("EmpSelect.aspx?user=" + username + " ", "window", "dialogWidth:650px;DialogHeight=580px;status:yes;scroll=yes;help:yes'");
if(dlg)
location.href = dlg;
}
empselect.aspx页面中button事件中写
this.ClientScript.RegisterStartupScript(this.GetType(), "returnvalue","<script language=javascript>window.opener=null;window.close();window.retunValue = 'Employee_show.aspx?id=" + Username + "&key=1&list=" + id + "';</script>");