方法一:

Page.RegisterStartupScript("function","<script>你要调用的javascript函数名称;</script>");

但此方法在IE6中会崩溃。。。无法在IE6中使用 在IE8中可以用

方法二:

public void Meg(string ag)
{
       LiteralControl li = new LiteralControl();
       li.Text = "<script>javascript自定义函数名称('" + ag + "')</script>";
       Controls.Add(li);

}

此方法适应IE6和IE8

LiteralControl

表示 HTML 元素、文本和 ASP.NET 页中不需要在服务器上处理的任何其他字符串

具体可看:http://msdn.microsoft.com/zh-cn/library/system.web.ui.literalcontrol.aspx

controls :

具体可看:http://msdn.microsoft.com/zh-cn/library/ms164640(VS.80).aspx

相关文章:

  • 2022-12-23
  • 2021-11-01
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-06
猜你喜欢
  • 2021-12-18
  • 2022-12-23
  • 2022-01-15
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案