《手机编程计算器》由会员分享,可在线阅读,更多相关《手机编程计算器(5页珍藏版)》请在金锄头文库上搜索。
1、js.divNumber font-size:24px; font-family:“Courier New“; border:1px solid #333; width:58px; height:48px; cursor:pointer; text-align:center;#wrap width:420; height:400; border:1 solid black; background-color:rgb(230,230,130); background-image:url(“casio.bmp“); background-repeat:no-repeat; #op backgrou
2、nd-color:rgb(230,230,130); margin:10px 15px; height:260px; #result height:60px; margin:32px 5px 0 5px; border:1px solid #333; text-align:right; background-color:#FFF; font-size:36px; font-family:“Courier New“,“Times New Roman“; font-weight:bold; padding-top:8px; var temN1=“; var temN2=“; var temOpt=
3、“; function doClick(o) var t=o.innerHTML; var r=document.getElementById(“result“); if(t = “CE“) r.innerHTML=“0“;temN1=“;temN2=“;temOpt=“; else if(t=“=“) if(temOpt != “ break; case “-“:r.innerHTML=temN1+temOpt+temN2+“=“+(parseFloat(temN1)- parseFloat(temN2);break; case “*“:r.innerHTML=temN1+temOpt+te
4、mN2+“=“+(parseFloat(temN1)*parseFloa t(temN2);break; case “/“:r.innerHTML=temN1+temOpt+temN2+“=“+(parseFloat(temN1)/parseFloat (temN2);break; if(temOpt = “ | temN2 = “) return; else temN1=“;temN2=“;temOpt=“; else if(t=“+“ | t=“-“ | t=“*“ | t=“/“) if(temN1=“) return; temOpt=t; else if(temOpt=“) if(te
5、mN1=“ temN1+=t; else if(temN2=“ temN2+=t; r.innerHTML=temN1+temOpt+temN2; function show() var showHtml=“; var i var j for(i=1;i“; for(j=1;j“; if(i=1 if(i=1 if(i=1 if(i=1 if(i=2 if(i=2 if(i=2 if(i=2 if(i=3 if(i=3 if(i=3 if(i=3 if(i=4 if(i=4 if(i=4 if(i=4 showHtml+=“; showHtml+=“;var opObj=document.getElementById(“op“); opObj.innerHTML=showHtml;