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 事件,包括使用控件.Attributes.Add 方法及直接设置 Attributes 的方式实现 onfocus 和 onblur 等事件触发。
4009

被折叠的 条评论
为什么被折叠?



