私はJSには新しく、入力を受け取り、関連する出力を生成する非常に単純なプログラムを作成しようとしています。しかし、私は間違ったことをしている、それは動作していない。ここに私のコードです。document.getElementById()の値。
<html>
<head>
<title>Test</title>
<h1>Test</h1>
</head>
<body>
<p>Please type your input into the box below.</p>
<input type="number"; id="input">
<button type="submit"; onclick="Output()">Submit</button>
<pre id="OutputHere">Type an input first!</pre>
<script type="text/javascript">
window.onload = function {
if(document.getElementById("input").boolValue != null); {
Output();
}
}
function Output() {
var input = document.getElementById("input").value
switch(input) {
case 1:
document.getElementById("OutputHere").value="4"
case 2:
document.getElementById("OutputHere").value="9"
}
}
うわー、私の答え:)コナー部から、その不公平が最初だったし、それは動作しますが、説明し、すべてのもの。犯罪はありませんspencer.sm – Ionut
@Ionut +1しかし、誰のためのものではなく、コンテンツの質のためです。 – zer00ne
@ zer00ne、ありがとう。私は感謝のためにうれしいです。私はあなたの答えにあなたと同様に努力しなければなりませんでした。 – Ionut