How to realize Calculator with JS
This article mainly shows you "JS how to achieve calculators", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and learn "how to achieve calculators in JS" this article.
JS Calculator body,p,input {margin: 0; padding: 0;} .wp {width: 500px; height: 500px; border:10px solid black; margin: 0 auto; margin-top: 100px;} # text {width: 480px; height: 90px; border-bottom: 10px solid black; font-size: 50px; line-height: 100px; text-align: left; padding-left: 20px; background: # ffffff } input {width: 125px; height: 100px; background: # c0c0c0; float: left; font-size: 40px; line-height: 100px; text-align: center;} _ window.onload = function () {var oText = document.getElementById ('text'); var aBtn = document.getElementsByTagName (' input'); var aText = oText.value for