.panel {
border: 4px solid #ddd;
width: 192px;
margin: 100px auto;
/border-radius: 6px;/
}
.panel p, .panel input {
font-family: "???ź?";
font-size: 20px;
margin: 4px;
float: left;
/border-radius: 4px;/
}
.panel p {
width: 122px;
height: 26px;
border: 1px solid #ddd;
padding: 6px;
overflow: hidden;
}
.panel input {
width: 40px;
height: 40px;
border:1px solid #ddd;
}
function cal(e) {
var obj = e.target || e.srcElement;
if(obj.nodeName != "INPUT") {
return;
}var value = obj.value; var screen = document.getElementById("screen"); if(value=="C") { screen.innerHTML = ""; } else if (value=="=") { var exp = screen.innerHTML; try { var r = eval("("+exp+")"); screen.innerHTML = r; } catch(e) { console.log(e); screen.innerHTML = "Error"; } } else { screen.innerHTML += value; } }