javascriptを使用して変数を使用した計算で運動していますが、変数に上付き文字を使用する方法がわかりません。いくつかの助けを借りてJavascript calculations holding variables私は一般的に計算を行う方法を学んだが、私の新しい質問は上付き文字の使い方ですか?事前に上付き文字の計算JavaScriptの変数
<form name="Calcultor" Method="Get" id='form1'>First Number:
<input type="text" name="first" size="35" id="first">+ Second Number:
<input type="text" name="second" size="35" id="second">
\t
<br>Answer:
<input type="text" name="ans" size="35" id="ans" />
<input type="text" name="ans2" size="35" id="ans2" />
<button type="button" onclick="Calculate();">Calculate</button>
</form>
<script>
function Calculate() {
var first = document.getElementById('first').value;
var second = document.getElementById('second').value;
\t var ans = document.getElementById('ans').value;
\t var ans2 = document.getElementById('ans2').value;
\t
document.getElementById('ans').value = parseInt(first) + parseInt(second);
document.getElementById('ans2').value = 1.112 - 0.00043499 * parseInt(document.getElementById('ans').value)/*insert ans into a parenthensis*/ + 0.00000055 * parseInt(document.getElementById('ans').value)/*insert ans into a parenthensis and ^2 outside the parenthesis*/ - 0.00028826;
}
</script>
"_Superscript_"は指数を意味しますか? – Teemu
多分[This](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/pow)はあなたが望むものですか? – Ammar
はい!訂正ありがとう! –