因为无法修改源代码,所以只能改.aspx页面文件,想给一个button增加一个onclick事件,在2.0里可以加个属性OnClientClick,1.0里面没有这个属性,请问该如何用?同时不影响该按钮回发后的服务端事件,只是在回发之前执行一下js。
------解决方案--------------------------------------------------------
vs2003里没有OnClientClick,可以这样:
- C# code
protected void Page_Load(object sender, EventArgs e){ Button1.Attributes.Add("onclick", "return confirm('xxxx')");}
------解决方案--------------------------------------------------------
.......你们的回答真是。。。。
------解决方案--------------------------------------------------------
window.onload = function(){
document.getElementById("button1").onclick = function(){
//your code here
};
};