Javascript运行时错误:'myfunction'未定义 [英] Javascript runtime error: 'myfunction' is undefined

查看:247
本文介绍了Javascript运行时错误:'myfunction'未定义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在代码隐藏中:

In the code-behind:

Page.ClientScript.RegisterStartupScript(
   GetType(),
   "MyKey",
   "myFunction();",
   true);



并且在.aspx中:


and in the .aspx:

<script type="text/javascript">
  function myFunction() {
    debugger;
  }
</script>
But I got JavaScript runtime error: 'myFunction' is undefined.  What's wrong in my code?  Thanks.





我尝试了什么:



JavaScript运行时错误:'myFunction'未定义



What I have tried:

JavaScript runtime error: 'myFunction' is undefined

推荐答案

试试这个

try this
ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "MyKey", "myFunction();", true);


这篇关于Javascript运行时错误:'myfunction'未定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆