能否举例说明?
不要直接贴MSDN
设置属性如:
btnOk.Attributes.Add("onclick","return checkForm();");
前台效果:<input type = "button" onclick="return checkForm();" id="btnOk">
你在设计页面的时候的代码
<input type=button id="button1" runat=server>
如果你在后台代码中
button1..Attributes.Add("onclick","alert(测试);");
那么你运行后
你在浏览器中查看这个页面的源代码就会发现
原来button 的代码变为
<input type=btton id=button1 onclick="alert(测试);">