html css JavaScriptで電卓を作成したいのですが、下記のプログラムでは入力も受け付けず、動作しません。
どの様に修正すれば、良いでしょうか?
<!DOCTYPE html> <html lang=ja> <head> <meta charset="UTF-8" /> <title>簡易電卓</title> <style type="text/css"> button { height : 50px; width : 50px; } button.equal { height : 160px; } button.zero { width : 160px; } div#panel { height : 25px; width : 100%; border : 1px solid #000000; text-align : right; padding-right : 5px; } </style> <script type="text/JavaScript"> var panelNumber ="0"; var svButton =""; var svEnzanshi =""; var svNumber = 0; function clPanel() { panelNumber ="0"; svButton =""; svEnzanshi =""; svNumber =0; document.getElementById("panel").innerText = panelNumber; } function pushNum(pushNumber) { svButton = panelNumber; if (panelNumber == "0"){ panelNumber = pushNumber; } else { panelNumber += pushNumber; } document.getElementById("panel").innerText = panelNumber; } function keisan(svEnzanshi) { var panel = document.getElementById("panel"); var number = parseFloat(panel.innerText); var answer = null; if (answer == "/" || number == "NULL") { alert("ゼロで除算はできません"); return; } if(svButton == "+" || svButton == "-" || svButton == "*" || svButton == "/") { answer = enzanshi; }else{ switch (svEnzanshi) { case "+": answer = svNumber + number; break; case "+": answer = svNumber + number; break; case "+": answer = svNumber + number; break; case "+": answer = svNumber + number; break; } if (answer != null) { panel.innerText = answer; } panelNumber = "0"; svButton = panelNumber; svEnzanshi = panelNumber; svNumber = parseFloat(panel.innerText); } } </script> </head> <body> <table border="0"> <tr> <td colspan="5"><div id="panel">0</div></td> </tr> <tr> <td><button onclick="pushNum('7')">7</button></td> <td><button onclick="pushNum('8')">8</button></td> <td><button onclick="pushNum('9')">9</button></td> <td><button onclick="keisan('+')">+</button></td> <td><button onclick="clpanel()">C</button></td> </tr> <tr> <td><button onclick="pushNum('4')">4</button></td> <td><button onclick="pushNum('5')">5</button></td> <td><button onclick="pushNum('6')">6</button></td> <td><button onclick="keisan('-')">-</button></td> <td rowspan="3"><button class="equal" onclick="keisan('=')">=</button></td> </tr> <tr> <td><button onclick="pushNum('1')">1</button></td> <td><button onclick="pushNum('2')">2</button></td> <td><button onclick="pushNum('3')">3</button></td> <td><button onclick="keisan('*')">×</button></td> </tr> <tr> <td colspan="3"><button class="zero" onclick="pushNum('0')">0</button></td> <td><button onclick="keisan('keisan('/')')">÷</button></td> </tr> </table> </body> </html>