我在Visual Studio 2015中创建了新项目。它是JavaScript的Windows应用程序。我试图制作"你好"应用程序,但当我想编译它我得到这个错误:
0x800a138f - JavaScript运行时错误:无法设置属性' onclick'未定义或空引用
我的代码:
document.getElementById("button").onclick = function () {
var jmeno = document.getElementById("Jmeno").value
var pop = new Windows.UI.Popups.MessageDialog("<%=Ahoj.Clientid%>" + jmeno);
pop.showAsync()
}
&#13;
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>App1</title>
<!-- WinJS references -->
<link href="WinJS/css/ui-dark.css" rel="stylesheet" />
<script src="WinJS/js/base.js"></script>
<script src="WinJS/js/ui.js></script>
<!-- App1 references -->
<link href="/css/default.css" rel="stylesheet" />
<script src="/js/default.js"></script>
<script src="js/zdravic.js"></script>
</head>
<body class="win-type-body">
<header>
<h1>Hello user! :)</h1>
</header>
<section>
<input id='Jmeno' type="text" placeholder="Zadej své jméno"/>
<button id="button">Klikni na mě!</button>
</section>
</body>
</html>
&#13;
而对于更多,default.css并不适合我。就像它不会在那里。是的,我已将它链接到那里。
答案 0 :(得分:2)
您正在尝试访问尚未加载的元素
尝试:
If (money > 0) {
tens = (int) money / 10;
money = money % 10;
System.out.printlm(tens + "pcs of 10 peso coin");
}
If (money > 0) {
fives = (int) money / 5;
money = money % 5;
System.out.printlm(fives + "pcs of 5 peso coin");
}
If (money > 0) {
ones = (int) money % 1;
money = money % 1;
System.out.printlm(ones + "pcs of 1 peso coin");
}