js计算器

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

styletype=text/cssinput.inpt{width:84%;height:30px;margin-left:5%;margin-top:10px;}div{width:90%;margin-left:5%;margin-top:20px;}divinput{width:45px;height:30px;}/stylescriptlanguage=javascripttype=text/javascriptvarnum1=;varnum2=;varmes=;functionleijia(btnNum){if(document.form1.txt2.value==){num1=;}num1+=btnNum;document.form1.txt2.value=num1;}functionfangfa(btnFang){if(btnFang!==&&btnFang!=←){document.form1.txt2.value=;mes+=num1+btnFang;document.form1.txt1.value=mes;}elseif(btnFang===){mes+=num1;document.form1.txt1.value=;document.form1.txt2.value=eval(mes);mes=eval(mes);num1=;}elseif(btnFang==←){if(num1.length==1){num1=;document.form1.txt2.value=0;}elseif(num1==){document.form1.txt2.value=0;}else//123456{num1=num1.substring(0,num1.length-1);document.form1.txt2.value=num1;}}}/script/headbodyformname=form1style=width:300px;height:250px;border:3pxsolid#000000inputtype=textname=txt1id=txt1class=inpt/br/inputtype=textname=txt2id=txt2class=inptstyle=font-size:20px;text-align:right;/br/divid=btndivinputtype=buttonname=btn7value=7onclick=leijia(this.value)/inputtype=buttonname=btn8value=8onclick=leijia(this.value)/inputtype=buttonname=btn9value=9onclick=leijia(this.value)/inputtype=buttonname=btnCuvalue=/onclick=fangfa(this.value)/inputtype=buttonname=btnYvalue=%onclick=fangfa(this.value)/br/inputtype=buttonname=btn4value=4onclick=leijia(this.value)/inputtype=buttonname=btn5value=5onclick=leijia(this.value)/inputtype=buttonname=btn6value=6onclick=leijia(this.value)/inputtype=buttonname=btnCevalue=*onclick=fangfa(this.value)/inputtype=buttonname=btnTvalue=←onclick=fangfa(this.value)/br/inputtype=buttonname=btn1value=1onclick=leijia(this.value)/inputtype=buttonname=btn2value=2onclick=leijia(this.value)/inputtype=buttonname=btn3value=3onclick=leijia(this.value)/inputtype=buttonname=btnJivalue=-onclick=fangfa(this.value)/inputtype=buttonname=btnJavalue=+onclick=fangfa(this.value)/br/inputtype=buttonname=btn0value=0onclick=leijia(this.value)style=width:98px;/inputtype=buttonname=btnDvalue=.onclick=leijia(this.value)/inputtype=buttonname=btnDengvalue==onclick=fangfa(this.value)style=width:98px;/br//div/form

1 / 3
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功