标题:window.close() 问题
只看楼主
yunj1105
Rank: 1
等 级:新手上路
威 望:1
帖 子:757
专家分:0
注 册:2007-2-13
 问题点数:0 回复次数:2 
window.close() 问题
'Default2.aspx'
protected void Button1_Click(object sender, EventArgs e)
{
string str = "<script language='javascript' defer>ret = window.showModalDialog('Default3.aspx',window,'dialogHeight:250px;dialogWidth:600px;center:Yes;Help:No;Resizable:No;Scroll:auto;Status:no;');</script>";
Response.Write(str);
}
Default3.aspx
protected void Button1_Click(object sender, EventArgs e)
{
string str1 = "<script language='javascript'>window.close();</script>";
Response.Write(str1);
}
为什么从'Default2.aspx'跳转到'Default3.aspx'时,点了button'Default3.aspx'不会关闭呢?
搜索更多相关主题的帖子: window close script sender void 
2007-05-22 16:22
islet
Rank: 12Rank: 12Rank: 12
等 级:贵宾
威 望:89
帖 子:6548
专家分:0
注 册:2005-1-28
得分:0 
关闭按钮没必要让服务器端处理
就用普通按钮
<button onclick="window.close()">关闭</button>
2007-05-22 16:26
yunj1105
Rank: 1
等 级:新手上路
威 望:1
帖 子:757
专家分:0
注 册:2007-2-13
得分:0 
是因为button还有一些其他操作数据库的功能
Default3.aspx
protected void Button1_Click(object sender, EventArgs e)
{
if (TextBox2.Text == "" || TextBox3.Text == "")
{
Response.Write("<script defer>alert('请输入专业ID与名称!');</script>");
return;
}
if (Request["action"] == "edit")
{
string strCmd = "update lab_major set dept_id='" + DropDownList1.SelectedValue + "',major_ID='" + TextBox2.Text + "',major_name='" + TextBox3.Text + "' where major_num like '" + Request["majornum"] + "";
co_major_add.ENQ(strCmd);
}
else
{
string strC = "select * from lab_major where major_id like'" + TextBox2.Text + "' or major_name like'" + TextBox3.Text + "'";
object a = co_major_add.EXS(strC);
if (a == null)
{
string strCmd1 = "insert lab_major (major_id,major_name,dept_ID) values('" + TextBox2.Text + "','" + TextBox3.Text + "','" + DropDownList1.SelectedValue + "')";
co_major_add.ENQ(strCmd1);
Response.Write("<script defer>alert('添加成功!');</script>");

}
else
{
Response.Write("<script defer>alert('您输入的已存在,请重新输入!');</script>");
}
}
string str1 = "<script language='javascript'>window.dialogArguments.document.location.href='Major.aspx';window.close();</script>";
Response.Write(str1);
}

2007-05-22 16:34



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-141535-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.162755 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved