当前位置: 代码迷 >> ASP.NET >> 怎么动态添加html控件的事件
  详细解决方案

怎么动态添加html控件的事件

热度:2276   发布时间:2013-02-26 00:00:00.0
如何动态添加html控件的事件
在后台如何动态添加html控件的事件,或者控制html控件的事件

------解决方案--------------------------------------------------------

private void Page_Load(object sender, System.EventArgs e)
{
if(!IsPostBack)
{
this.HyperLink5.Attributes.Add( "onclick ", "exitLogin(); ");

}
}
------解决方案--------------------------------------------------------
<input type=button id=btn>
<script>
document.all[ 'btn '].onclick = function xx()}{alert( '动态事件 ')!};
</script>

也可以用AttachEvent
  相关解决方案