aspx.net后台调用前台JS方法

方法1:

   ScriptManager.RegisterStartupScript(this.Button1, this.GetType(), "alertScript", "window.open('default2.aspx');", true); 其中第一个参数为要注册脚本的控件ID,试了一下,只要是本页面的就行。  第二个参数为注册脚本控件类型,是控件还是this的GetType()都可以,typeOf(string)也没问题. 第三个脚本

 

方法2:

Page.RegisterStartupScript("2013","<script>seData();</script>");//调用前台JS方法

以上方法效果一样

 

posted @ 2013-06-06 10:51  王春天  阅读(721)  评论(0)    收藏  举报
云推荐