C#后台调用JS

方法1:
<asp:Literal ID="ltScript" runat="server"></asp:Literal>

private void Button1_Click(object sender, System.EventArgs e)
{
      ltScript.Text = "<script type=\"text/javascript\">你要执行的js函数;</script>";

}
方法2:
ClientScript.RegisterStartupScript(this.GetType(), "LoadPicScript", "<script>alert('JS代码');</script>");

posted @ 2012-08-03 10:58  飛雲若雪  阅读(410)  评论(0编辑  收藏  举报