日期:2014-05-20  浏览次数:20500 次

脚本事件
<asp:Button   ID= "Button2 "   runat= "server "   Text= "Button "   OnClick= "javascript:alert( 'hello ') "   />
或者
<asp:Button   ID= "Button2 "   runat= "server "   Text= "Button "   OnClick= "javascript:aa(); "/>
======
我想在点击时执行这两个脚事件,为什么叫是报错,而换成了html中的按钮就可以了呢?

------解决方案--------------------
<asp:Button ID= "Button2 " runat= "server " Text= "Button " OnClientClick= "javascript:alert( 'hello ') " />

Button2.Attributes[ "onclick "] = "alert( 'hello '); "