document.getElementById("outcome").value
を変数outcome
に割り当てます。 ボタンをクリックすると、idが "outcome"の入力値を "Something"に設定したいと思います。フォーム入力の値を設定できません
しかし、以下のコードを実行すると、入力フォームの結果が設定されませんでした。 入力フォームの結果は何も起こりません。
function throwDice() {
var point=document.getElementById("point").value;
var outcome=document.getElementById("outcome").value;
outcome=Somthing;
}
その後、私はこのコードを修正します。
function throwDice() {
var point=document.getElementById("point").value;
document.getElementById("outcome").value="Something";
}
私が行うすべては、それが直接document.getElementById("outcome").value
に可変の成果と アサイン「何か」を割り当てる削除しています。 この場合、入力フォームの結果の値は「Something」です。
私の質問は、outcome="Something"
が動作しない理由です。
変数はプロパティへの参照ではありません。私のひどい英語、あなたは私の質問に答えるが、 – Bergi