Response.Write("<script language='javascript'>");
Response.Write("if(!confirm('是否需要发送消息?')) {return fasle;}");
Response.Write("</script>");
上面是写在按钮事件里的 点的时候就脚本报错 return语句在函数之外
网上看了下 是不行 不过我想知道下更明确点的解释 哪位说一下啊
Response.Write("if(!confirm('是否需要发送消息?')) {return fasle;}");
Response.Write("</script>");
上面是写在按钮事件里的 点的时候就脚本报错 return语句在函数之外
网上看了下 是不行 不过我想知道下更明确点的解释 哪位说一下啊
这样写
btn(你的按钮).attrabute.add("onclick","jiaoben");
{
// 在此处放置用户代码以初始化页面 if(this.Page.IsPostBack == false)
{
this.Button1.Attributes.Add("onclick","return confirm('是否需要发送消息?')");
}
}
在Page_Load()事件中写上
this.Button1.Attributes.Add("onclick","return confirm('是否需要发送消息?')");
这行代码就可以实现你的效果了,Button1换成你发送按钮的ID,参考上面的代码
{
// 在此处放置用户代码以初始化页面 if(this.Page.IsPostBack == false)
{
this.Button1.Attributes.Add( "onclick ", "return confirm( '是否需要发送消息? ') ");
}
}
在Page_Load()事件中写上
this.Button1.Attributes.Add( "onclick ", "return confirm( '是否需要发送消息? ') ");
这行代码就可以实现你的效果了,Button1换成你发送按钮的ID,参考上面的代码 这我知道
Response.Write( "if(!confirm( '是否需要发送消息? ')) {window.close();} "); 这样是可以
Response.Write( " </script> ");
我就是想试下 看能不能点取消直接输出返回而不执行后续操作 你们明白不?
Response.Write(" <script language= 'javascript '> ");
Response.Write(" function btnClick(){");
Response.Write("if(!confirm( '是否需要发送消息? ')){return fasle;} ");
Response.Write(" }</script> ");
按扭直接添加onclick属性就行了