EG:
1. Button1.Attributes.Add("onClick","return confirm('提示信息')");
2.textbox1.Attributes.Add("onfocus","document.getElementById('textbox2').style.display='');
3.textbox1.Attributes.Add("onblur","document.getElementById('textbox2').style.display='none');
格式:
1。控件.Attributes.add("事件","javaScript脚本");
2。控件.Attributes["事件"]="javascript:return 方法(..)";
(放在Page_Load()中)
ASP.NET 中添加JavaScript事件
本文介绍了如何在ASP.NET中为控件添加JavaScript事件,包括点击事件、获取焦点事件及失去焦点事件等,并提供了具体的代码示例。
4001





