JavaScript emulator case source code

Time:2020-9-16

design sketch

index.html

calc.css

*{
    margin:0px;
    padding:0px;
}
div{
    width: 170px;
}
#div1{
    top:60px;
    left: 100px;
    position: absolute;
}
input[type="button"]{
    width: 30px;
    margin-right: 5px;

}
input[type="text"]{
    width: 152px;
    text-align: right;
    background-color: #fff;
    border: 1px solid;
    padding-right: 5px;
    box-sizing: border-box;
}

input[type="button"]:hover{
    background-color: yellow;
    border: 1px solid;
}

calc.js

function init(){
    var num=document.getElementById("num");
    num.value=0;
    num.disabled="disabled";

    var oButton=document.getElementsByTagName("input");
    var btn_num1;
    var fh;
    for(var i=0;i