2つの数値をテキストボックスから取得して計算し、innerhtmlを使用して表示しましたが、このコードで何が間違っているのでしょうか Javaスクリプトを使用して2つの数値を追加する際に間違いがあります
<body onload="alert('Hey check out my Calculator')">
<h1 align="center" > functional calulator </h1>
<div class="Calculator" align="center">
\t <input type="text" name="text1" id="a1">Enter 1st Number <br><br>
\t <input type="text" name="text2" id="a2">Enter 2nd Number<br><br>
\t <button onclick="add()" >Add</button>
\t <p id="p1"></p>
\t
\t <script type="text/javascript"> \t
\t \t function add(){
\t \t \t var a = document.getElementById("a1").value;
\t \t \t var b = document.getElementByID("a2").value;
\t \t \t var total = a + b;
\t \t \t document.getElementById("p1").innerHTML = total;
\t \t \t
\t \t \t
\t \t }
\t \t </script>
は精巧なのdocument.getElementByIdありません。何を手に入れていますか? – j08691