另开贴寻求帮助:使用(javascipt)windows.open打开新窗口的问题-----------急

corder_li 2007-07-23 08:52:59
原帖地址:
http://community.csdn.net/Expert/topic/5667/5667226.xml?temp=.5639154


private void Button4_Click(object sender, System.EventArgs e)
{
this.Page.RegisterStartupScript("open","<script>window.open ('StateInfo1.aspx', '', 'height=20, width=260, top=200, left=550, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=yes');</script>");

}

请高手指教,谢谢!




...全文
209 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
corder_li 2007-07-23
  • 打赏
  • 举报
回复
不知道说清楚了吗
corder_li 2007-07-23
  • 打赏
  • 举报
回复
我是lZ:我把问题重新说一遍,总结如下:
我有数据库操作,而其不同的条件弹出不同的页面,现在就是要解决

在A页面上点击一个摁妞打开一个新的B页面,然后关闭B页面,再刷新A页面,发生的问题是B页面也跳出来了,不知道怎么回事?

代码如下:


private void Button3_Click(object sender, System.EventArgs e)
{
//查询在同一类别中是否有与此编号相同的名称
string serial_name = TextBox3.Text.ToString();//名称编号.
string attachName = DropDownList5.SelectedValue;
// string goodsName = TextName.Text.ToString();//名称
string sort =DropDownList4.SelectedValue;//类别
int nserial_name = Convert.ToInt32(serial_name);
string sql = "select count(*) from InputDetail where 归属 ='"+attachName+"'and 类别编号 = '" +sort+"'and 名称编号="+nserial_name+"";
CDataBaseAccess database = new CDataBaseAccess();
int count = database.ExcuteSql(sql);
if(count != 0)
{


this.Page.RegisterStartupScript("open","<script>window.open ('StateInfo1.aspx', '', 'height=20, width=260, top=200, left=550, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=yes');</script>");

}
else if(count == 0)
{

this.Page.RegisterStartupScript("open","<script>window.open ('StateInfo2.aspx', '', 'height=20, width=260, top=200, left=550, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=yes');</script>");

}
}

BearRui 2007-07-23
  • 打赏
  • 举报
回复
这样加在page_load中


if (!IsPostBack)
{
button4.Attribute["onClick"] = "<script>window.open ('StateInfo1.aspx', '', 'height=20, width=260, top=200, left=550, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=yes');</script>";
}
corder_li 2007-07-23
  • 打赏
  • 举报
回复
有人能帮我呢
corder_li 2007-07-23
  • 打赏
  • 举报
回复
这样的话把下面的方法放在page_load里的话有问题吧

button4.Attribute["onClick"] = "<script>window.open ('StateInfo1.aspx', '', 'height=20, width=260, top=200, left=550, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=yes');</script>";

忘了说了,加在 page_load 事件里`
你试试看,能不能搞定你的问题
corder_li 2007-07-23
  • 打赏
  • 举报
回复
我有数据库操作,而其不同的条件弹出不同的页面:

private void Button3_Click(object sender, System.EventArgs e)
{
//查询在同一类别中是否有与此编号相同的名称
string serial_name = TextBox3.Text.ToString();//名称编号.
string attachName = DropDownList5.SelectedValue;
// string goodsName = TextName.Text.ToString();//名称
string sort =DropDownList4.SelectedValue;//类别
int nserial_name = Convert.ToInt32(serial_name);
string sql = "select count(*) from InputDetail where 归属 ='"+attachName+"'and 类别编号 = '" +sort+"'and 名称编号="+nserial_name+"";
CDataBaseAccess database = new CDataBaseAccess();
int count = database.ExcuteSql(sql);
if(count != 0)
{


this.Page.RegisterStartupScript("open","<script>window.open ('StateInfo1.aspx', '', 'height=20, width=260, top=200, left=550, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=yes');</script>");

}
else if(count == 0)
{

this.Page.RegisterStartupScript("open","<script>window.open ('StateInfo2.aspx', '', 'height=20, width=260, top=200, left=550, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=yes');</script>");

}
}
BearRui 2007-07-23
  • 打赏
  • 举报
回复
是不是再一次激发了Button4_Click事件
corder_li 2007-07-23
  • 打赏
  • 举报
回复
人呢?
jtbin 2007-07-23
  • 打赏
  • 举报
回复
button4.Attribute["onClick"] = "<script>window.open ('StateInfo1.aspx', '', 'height=20, width=260, top=200, left=550, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=yes');</script>";

忘了说了,加在 page_load 事件里`
你试试看,能不能搞定你的问题
corder_li 2007-07-23
  • 打赏
  • 举报
回复
忘了说问题:
我遇到了这样的问题:
在A页面上点击一个摁妞打开一个新的B页面,然后关闭B页面,再刷新A页面,发生的问题是B页面也跳出来了,不知道怎么回事?

62,041

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧