home.js
我在默认 NavigationApp中有以下代码:
(function () {
"use strict";
WinJS.UI.Pages.define("/pages/home/home.html", {
// This function is called whenever a user navigates to this page. It
// populates the page elements with the app's data.
ready: function (element, options) {
var submit = document.getElementById("submitBtn");
submit.addEventListener("click", myFunc());
}
});
function myFunc() {
// Do some stuff here
}
})();
我遇到的问题是该功能myFunc()
在应用程序启动时立即执行,而不是像我预期的那样在按下提交按钮时执行;为什么是这样?