【发布时间】:2013-12-16 17:33:59
【问题描述】:
我的 html 代码中嵌入了一个 javascript 函数,但是当我运行该页面时出现此错误:Uncaught ReferenceError: myFunction is not defined。
我也在使用 angularjs,所以我有我的索引页面,正如他们解释的那样,我的部分页面,并且该功能在我的部分页面中。
当我从文件夹中双击网页时,我可以运行脚本,但是当我运行 web api 时,它会出现该错误。
我的javascript函数:
<script type="text/javascript">
function myFunction() {
var x;
var r = confirm("Press a button!");
if (r == true) {
x = "You pressed OK!";
}
else {
x = "You pressed Cancel!";
}
document.getElementById("demo").innerHTML = x;
}
我怎么称呼它:
<button onclick="myFunction()">Try it</button>
谁能帮助我? 想
【问题讨论】:
-
究竟什么是“Visual Studio Web Api”?也看看Should questions include “tags” in their titles?
标签: c# javascript angularjs