在<head>与</head>之间加入函数:
function aa(){
var bb;
bb=confirm('你真的確定嗎?');
if (bb==true){
alert('True');
}else{
alert('False');
}
}
然后在 page_load(object sender, System.EventArgs e) 中加入:
Button1.Attributes.Add("onclick","aa()")
如果 Button1 还要执行别的代码,可在 Button1_Click 中写。
博客介绍了在 Web 页面中添加按钮点击函数的方法。在 <head> 标签间加入确认提示函数 aa(),根据用户选择弹出不同提示。在 page_load 中为 Button1 添加 onclick 事件调用该函数,若 Button1 还有其他代码,可在 Button1_Click 中编写。
2318

被折叠的 条评论
为什么被折叠?



