[英]Exception in calling a function from another javascript file - Metro App
args.setPromise(WinJS.UI.processAll().then(TodoList.init()));
上面的语句使我感到异常,TodoList是未定义的。实际上,TodoList.js是位于Metro App Blank Project的js文件夹中的Javascript文件以及default.js。我正在调用TodoList js的init()函数文件。这是怎么了?
I've no idea what you do wrong. 我不知道你做错了什么。 But it works for me.
但这对我有用。 I created js file with next content:
我创建了具有以下内容的js文件:
var TodoList = {
init: function () {
(new Windows.UI.Popups.MessageDialog("TodoList.init()", "Message")).showAsync().done();
}
};
and I added link to this file in default.html
: 并且我在
default.html
添加了指向该文件的链接:
<link href="/css/default.css" rel="stylesheet" />
<script src="/js/TodoList.js"></script>
<script src="/js/default.js"></script>
and I got my message. 我得到了我的信息。 Please, recheck your code at least for reference to your js file.
请至少重新检查您的代码,以供参考您的js文件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.