对于submit,服务器的botton生成的html最终也是submit类型
<!
DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
>
< HTML >
< HEAD >
< TITLE > New Document </ TITLE >
< META NAME ="Generator" CONTENT ="EditPlus" >
< META NAME ="Author" CONTENT ="" >
< META NAME ="Keywords" CONTENT ="" >
< META NAME ="Description" CONTENT ="" >
< script >
/**//*
由于,表单是后面产生的,所有如果直接用window.frm.attachEvent家事件会说赵不到'window.frm对象'
*/
window.attachEvent("onload",function(){
window.frm.attachEvent("onsubmit",function(){
return confirm("提交?");
});
});
</ script >
</ HEAD >
< BODY >
< form id =frm >
< input type =text value ="改变我看看提交没" ></ input >< input type ="submit" ></ input >
</ form >
</ BODY >
</ HTML >
< HTML >
< HEAD >
< TITLE > New Document </ TITLE >
< META NAME ="Generator" CONTENT ="EditPlus" >
< META NAME ="Author" CONTENT ="" >
< META NAME ="Keywords" CONTENT ="" >
< META NAME ="Description" CONTENT ="" >
< script >
/**//*
由于,表单是后面产生的,所有如果直接用window.frm.attachEvent家事件会说赵不到'window.frm对象'
*/
window.attachEvent("onload",function(){
window.frm.attachEvent("onsubmit",function(){
return confirm("提交?");
});
});
</ script >
</ HEAD >
< BODY >
< form id =frm >
< input type =text value ="改变我看看提交没" ></ input >< input type ="submit" ></ input >
</ form >
</ BODY >
</ HTML >
对于linkbutton,由于是服务器控件,所有它生成html后href属性会等于__doPostBack('test',''),如何要产生确认按钮很简单,两步搞定:
1.在后台的.cs代码让他的Attributes["href"]属性等于一个前台的js函数。
2.这个前台js函数如果confirm就执行__doPostBack('test','')就可以了