资料
表格
制度
合同
管理
职场
经营
创业
范文
总结
计划
作文
文章
美文
词句
教程
模板
图片
字体
图标
办公
人事
财务
生产
管理资源吧首页
>>>
教程
>>>
编程
>>>
JavaScript教程
>>>
功能很全的精品JS计算器
<HTML><HEAD><TITLE>网页特效|XFBBS.Com|---功能很全的精品计算器</TITLE> <META http-equiv=Content-Type content="text/html; charset=gb2312"> <META http-equiv=Content-Language content=zh-cn> <META http-equiv=Page-Enter content=blendTrans(Duration=0.5)> <META http-equiv=Page-Exit content=blendTrans(Duration=0.5)> <STYLE type=text/css>P { FONT-SIZE: 9pt; FONT-FAMILY: "Verdana" } TD { FONT-SIZE: 9pt; LINE-HEIGHT: normal } A { FONT-SIZE: 9pt; TEXT-TRANSFORM: none; COLOR: #326969; TEXT-DECORATION: none } A:hover { FONT-SIZE: 9pt; LEFT: 1px; COLOR: #0000ff; POSITION: relative; TOP: 1px; TEXT-DECORATION: none } BODY { FONT-SIZE: 9pt; CURSOR: url('body.cur'); SCROLLBAR-ARROW-COLOR: #ffffff; SCROLLBAR-BASE-COLOR: #cde0c2 } .diary_tb { WIDTH: 100%; WORD-BREAK: break-all; FONT-FAMILY: "Verdana","宋体"; POSITION: relative; TEXT-ALIGN: center; WORD-WRAP: break-word } .diary_main { TABLE-LAYOUT: fixed; BACKGROUND-POSITION: left top; FONT-SIZE: 12px; COLOR: #005782; WORD-BREAK: break-all; LINE-HEIGHT: 24px; FONT-FAMILY: "宋体"; LINE-BREAK: strict; HEIGHT: 2px; TEXT-ALIGN: left } </STYLE> <META content="MSHTML 6.00.2600.0" name=GENERATOR></HEAD> <CENTER> <table id=AutoNumber2 style="BORDER-COLLAPSE: collapse" borderColor=#808080 cellSpacing=0 cellPadding=0 width=760 border=0> </TABLE> <img src="/_New/_cj/myeditor/sysimage/space.gif" class="ewebeditor__script" _ewebeditor_fake_tag="script" _ewebeditor_fake_value="%3CSCRIPT%20language%3Djavascript%3E%20%0D%0A%3C!--%20%0D%0Avar%20endNumber%3Dtrue%20%0D%0Avar%20mem%3D0%20%0D%0Avar%20carry%3D10%20%0D%0Avar%20hexnum%3D%220123456789abcdef%22%20%0D%0Avar%20angle%3D%22d%22%20%0D%0Avar%20stack%3D%22%22%20%0D%0Avar%20level%3D%220%22%20%0D%0Avar%20layer%3D0%20%0D%0A%0D%0A%0D%0A%2F%2F%E6%95%B0%E5%AD%97%E9%94%AE%20%0D%0A%0D%0Afunction%20inputkey(key)%20%0D%0A%7B%20%0D%0Avar%20index%3Dkey.charCodeAt(0)%3B%20%0D%0Aif%20((carry%3D%3D2%20%26%26%20(index%3D%3D48%20%7C%7C%20index%3D%3D49))%20%0D%0A%7C%7C%20(carry%3D%3D8%20%26%26%20index%3E%3D48%20%26%26%20index%3C%3D55)%20%0D%0A%7C%7C%20(carry%3D%3D10%20%26%26%20(index%3E%3D48%20%26%26%20index%3C%3D57%20%7C%7C%20index%3D%3D46))%20%0D%0A%7C%7C%20(carry%3D%3D16%20%26%26%20((index%3E%3D48%20%26%26%20index%3C%3D57)%20%7C%7C%20(index%3E%3D97%20%26%26%20index%3C%3D102))))%20%0D%0Aif(endNumber)%20%0D%0A%7B%20%0D%0AendNumber%3Dfalse%20%0D%0Adocument.calc.display.value%20%3D%20key%20%0D%0A%7D%20%0D%0Aelse%20if(document.calc.display.value%20%3D%3D%20null%20%7C%7C%20document.calc.display.value%20%3D%3D%20%220%22)%20%0D%0Adocument.calc.display.value%20%3D%20key%20%0D%0Aelse%20%0D%0Adocument.calc.display.value%20%2B%3D%20key%20%0D%0A%7D%20%0D%0A%0D%0Afunction%20changeSign()%20%0D%0A%7B%20%0D%0Aif%20(document.calc.display.value!%3D%220%22)%20%0D%0Aif(document.calc.display.value.substr(0%2C1)%20%3D%3D%20%22-%22)%20%0D%0Adocument.calc.display.value%20%3D%20document.calc.display.value.substr(1)%20%0D%0Aelse%20%0D%0Adocument.calc.display.value%20%3D%20%22-%22%20%2B%20document.calc.display.value%20%0D%0A%7D%20%0D%0A%0D%0A%2F%2F%E5%87%BD%E6%95%B0%E9%94%AE%20%0D%0A%0D%0Afunction%20inputfunction(fun%2Cshiftfun)%20%0D%0A%7B%20%0D%0AendNumber%3Dtrue%20%0D%0Aif%20(document.calc.shiftf.checked)%20%0D%0Adocument.calc.display.value%3Ddecto(funcalc(shiftfun%2C(todec(document.calc.display.value%2Ccarry)))%2Ccarry)%20%0D%0Aelse%20%0D%0Adocument.calc.display.value%3Ddecto(funcalc(fun%2C(todec(document.calc.display.value%2Ccarry)))%2Ccarry)%20%0D%0Adocument.calc.shiftf.checked%3Dfalse%20%0D%0Adocument.calc.hypf.checked%3Dfalse%20%0D%0Ainputshift()%20%0D%0A%7D%20%0D%0A%0D%0Afunction%20inputtrig(trig%2Carctrig%2Chyp%2Carchyp)%20%0D%0A%7B%20%0D%0Aif%20(document.calc.hypf.checked)%20%0D%0Ainputfunction(hyp%2Carchyp)%20%0D%0Aelse%20%0D%0Ainputfunction(trig%2Carctrig)%20%0D%0A%7D%20%0D%0A%0D%0A%0D%0A%2F%2F%E8%BF%90%E7%AE%97%E7%AC%A6%20%0D%0A%0D%0Afunction%20operation(join%2Cnewlevel)%20%0D%0A%7B%20%0D%0AendNumber%3Dtrue%20%0D%0Avar%20temp%3Dstack.substr(stack.lastIndexOf(%22(%22)%2B1)%2Bdocument.calc.display.value%20%0D%0Awhile%20(newlevel!%3D0%20%26%26%20(newlevel%3C%3D(level.charAt(level.length-1))))%20%0D%0A%7B%20%0D%0Atemp%3Dparse(temp)%20%0D%0Alevel%3Dlevel.slice(0%2C-1)%20%0D%0A%7D%20%0D%0Aif%20(temp.match(%2F%5E(.*%5Cd%5B%5C%2B%5C-%5C*%5C%2F%5C%25%5C%5E%5C%26%5C%7Cx%5D)%3F(%5B%2B-%5D%3F%5B0-9a-f%5C.%5D%2B)%24%2F))%20%0D%0Adocument.calc.display.value%3DRegExp.%242%20%0D%0Astack%3Dstack.substr(0%2Cstack.lastIndexOf(%22(%22)%2B1)%2Btemp%2Bjoin%20%0D%0Adocument.calc.operator.value%3D%22%20%22%2Bjoin%2B%22%20%22%20%0D%0Alevel%3Dlevel%2Bnewlevel%20%0D%0A%0D%0A%7D%20%0D%0A%0D%0A%2F%2F%E6%8B%AC%E5%8F%B7%20%0D%0A%0D%0Afunction%20addbracket()%20%0D%0A%7B%20%0D%0AendNumber%3Dtrue%20%0D%0Adocument.calc.display.value%3D0%20%0D%0Astack%3Dstack%2B%22(%22%20%0D%0Adocument.calc.operator.value%3D%22%20%20%20%22%20%0D%0Alevel%3Dlevel%2B0%20%0D%0A%0D%0Alayer%2B%3D1%20%0D%0Adocument.calc.bracket.value%3D%22(%3D%22%2Blayer%20%0D%0A%7D%20%0D%0A%0D%0Afunction%20disbracket()%20%0D%0A%7B%20%0D%0AendNumber%3Dtrue%20%0D%0Avar%20temp%3Dstack.substr(stack.lastIndexOf(%22(%22)%2B1)%2Bdocument.calc.display.value%20%0D%0Awhile%20((level.charAt(level.length-1))%3E0)%20%0D%0A%7B%20%0D%0Atemp%3Dparse(temp)%20%0D%0Alevel%3Dlevel.slice(0%2C-1)%20%0D%0A%7D%20%0D%0A%0D%0Adocument.calc.display.value%3Dtemp%20%0D%0Astack%3Dstack.substr(0%2Cstack.lastIndexOf(%22(%22))%20%0D%0Adocument.calc.operator.value%3D%22%20%20%20%22%20%0D%0Alevel%3Dlevel.slice(0%2C-1)%20%0D%0A%0D%0Alayer-%3D1%20%0D%0Aif%20(layer%3E0)%20%0D%0Adocument.calc.bracket.value%3D%22(%3D%22%2Blayer%20%0D%0Aelse%20%0D%0Adocument.calc.bracket.value%3D%22%22%20%0D%0A%7D%20%0D%0A%0D%0A%2F%2F%E7%AD%89%E5%8F%B7%20%0D%0A%0D%0Afunction%20result()%20%0D%0A%7B%20%0D%0AendNumber%3Dtrue%20%0D%0Awhile%20(layer%3E0)%20%0D%0Adisbracket()%20%0D%0Avar%20temp%3Dstack%2Bdocument.calc.display.value%20%0D%0Awhile%20((level.charAt(level.length-1))%3E0)%20%0D%0A%7B%20%0D%0Atemp%3Dparse(temp)%20%0D%0Alevel%3Dlevel.slice(0%2C-1)%20%0D%0A%7D%20%0D%0A%0D%0Adocument.calc.display.value%3Dtemp%20%0D%0Adocument.calc.bracket.value%3D%22%22%20%0D%0Adocument.calc.operator.value%3D%22%22%20%0D%0Astack%3D%22%22%20%0D%0Alevel%3D%220%22%20%0D%0A%7D%20%0D%0A%0D%0A%0D%0A%2F%2F%E4%BF%AE%E6%94%B9%E9%94%AE%20%0D%0A%0D%0Afunction%20backspace()%20%0D%0A%7B%20%0D%0Aif%20(!endNumber)%20%0D%0A%7B%20%0D%0Aif(document.calc.display.value.length%3E1)%20%0D%0Adocument.calc.display.value%3Ddocument.calc.display.value.substring(0%2Cdocument.calc.display.value.length%20-%201)%20%0D%0Aelse%20%0D%0Adocument.calc.display.value%3D0%20%0D%0A%7D%20%0D%0A%7D%20%0D%0A%0D%0Afunction%20clearall()%20%0D%0A%7B%20%0D%0Adocument.calc.display.value%3D0%20%0D%0AendNumber%3Dtrue%20%0D%0Astack%3D%22%22%20%0D%0Alevel%3D%220%22%20%0D%0Alayer%3D%22%22%20%0D%0Adocument.calc.operator.value%3D%22%22%20%0D%0Adocument.calc.bracket.value%3D%22%22%20%0D%0A%7D%20%0D%0A%0D%0A%0D%0A%2F%2F%E8%BD%AC%E6%8D%A2%E9%94%AE%20%0D%0A%0D%0Afunction%20inputChangCarry(newcarry)%20%0D%0A%7B%20%0D%0AendNumber%3Dtrue%20%0D%0Adocument.calc.display.value%3D(decto(todec(document.calc.display.value%2Ccarry)%2Cnewcarry))%20%0D%0Acarry%3Dnewcarry%20%0D%0A%0D%0Adocument.calc.sin.disabled%3D(carry!%3D10)%20%0D%0Adocument.calc.cos.disabled%3D(carry!%3D10)%20%0D%0Adocument.calc.tan.disabled%3D(carry!%3D10)%20%0D%0Adocument.calc.bt.disabled%3D(carry!%3D10)%20%0D%0Adocument.calc.pi.disabled%3D(carry!%3D10)%20%0D%0Adocument.calc.e.disabled%3D(carry!%3D10)%20%0D%0Adocument.calc.kp.disabled%3D(carry!%3D10)%20%0D%0A%0D%0Adocument.calc.k2.disabled%3D(carry%3C%3D2)%20%0D%0Adocument.calc.k3.disabled%3D(carry%3C%3D2)%20%0D%0Adocument.calc.k4.disabled%3D(carry%3C%3D2)%20%0D%0Adocument.calc.k5.disabled%3D(carry%3C%3D2)%20%0D%0Adocument.calc.k6.disabled%3D(carry%3C%3D2)%20%0D%0Adocument.calc.k7.disabled%3D(carry%3C%3D2)%20%0D%0Adocument.calc.k8.disabled%3D(carry%3C%3D8)%20%0D%0Adocument.calc.k9.disabled%3D(carry%3C%3D8)%20%0D%0Adocument.calc.ka.disabled%3D(carry%3C%3D10)%20%0D%0Adocument.calc.kb.disabled%3D(carry%3C%3D10)%20%0D%0Adocument.calc.kc.disabled%3D(carry%3C%3D10)%20%0D%0Adocument.calc.kd.disabled%3D(carry%3C%3D10)%20%0D%0Adocument.calc.ke.disabled%3D(carry%3C%3D10)%20%0D%0Adocument.calc.kf.disabled%3D(carry%3C%3D10)%20%0D%0A%0D%0A%20%20%0D%0A%0D%0A%7D%20%0D%0A%0D%0Afunction%20inputChangAngle(angletype)%20%0D%0A%7B%20%0D%0AendNumber%3Dtrue%20%0D%0Aangle%3Dangletype%20%0D%0Aif%20(angle%3D%3D%22d%22)%20%0D%0Adocument.calc.display.value%3DradiansToDegress(document.calc.display.value)%20%0D%0Aelse%20%0D%0Adocument.calc.display.value%3DdegressToRadians(document.calc.display.value)%20%0D%0AendNumber%3Dtrue%20%0D%0A%7D%20%0D%0A%0D%0Afunction%20inputshift()%20%0D%0A%7B%20%0D%0Aif%20(document.calc.shiftf.checked)%20%0D%0A%7B%20%0D%0Adocument.calc.bt.value%3D%22deg%20%22%20%0D%0Adocument.calc.ln.value%3D%22exp%20%22%20%0D%0Adocument.calc.log.value%3D%22expd%22%20%0D%0A%0D%0Aif%20(document.calc.hypf.checked)%20%0D%0A%7B%20%0D%0Adocument.calc.sin.value%3D%22ahs%20%22%20%0D%0Adocument.calc.cos.value%3D%22ahc%20%22%20%0D%0Adocument.calc.tan.value%3D%22aht%20%22%20%0D%0A%7D%20%0D%0Aelse%20%0D%0A%7B%20%0D%0Adocument.calc.sin.value%3D%22asin%22%20%0D%0Adocument.calc.cos.value%3D%22acos%22%20%0D%0Adocument.calc.tan.value%3D%22atan%22%20%0D%0A%7D%20%0D%0A%0D%0Adocument.calc.sqr.value%3D%22x%5E.5%22%20%0D%0Adocument.calc.cube.value%3D%22x%5E.3%22%20%0D%0A%0D%0Adocument.calc.floor.value%3D%22%E5%B0%8F%E6%95%B0%22%20%0D%0A%7D%20%0D%0Aelse%20%0D%0A%7B%20%0D%0Adocument.calc.bt.value%3D%22d.ms%22%20%0D%0Adocument.calc.ln.value%3D%22%20ln%20%22%20%0D%0Adocument.calc.log.value%3D%22log%20%22%20%0D%0A%0D%0Aif%20(document.calc.hypf.checked)%20%0D%0A%7B%20%0D%0Adocument.calc.sin.value%3D%22hsin%22%20%0D%0Adocument.calc.cos.value%3D%22hcos%22%20%0D%0Adocument.calc.tan.value%3D%22htan%22%20%0D%0A%7D%20%0D%0Aelse%20%0D%0A%7B%20%0D%0Adocument.calc.sin.value%3D%22sin%20%22%20%0D%0Adocument.calc.cos.value%3D%22cos%20%22%20%0D%0Adocument.calc.tan.value%3D%22tan%20%22%20%0D%0A%7D%20%0D%0A%0D%0Adocument.calc.sqr.value%3D%22x%5E2%20%22%20%0D%0Adocument.calc.cube.value%3D%22x%5E3%20%22%20%0D%0A%0D%0Adocument.calc.floor.value%3D%22%E5%8F%96%E6%95%B4%22%20%0D%0A%7D%20%0D%0A%0D%0A%7D%20%0D%0A%2F%2F%E5%AD%98%E5%82%A8%E5%99%A8%E9%83%A8%E5%88%86%20%0D%0A%0D%0Afunction%20clearmemory()%20%0D%0A%7B%20%0D%0Amem%3D0%20%0D%0Adocument.calc.memory.value%3D%22%20%20%20%22%20%0D%0A%7D%20%0D%0A%0D%0Afunction%20getmemory()%20%0D%0A%7B%20%0D%0AendNumber%3Dtrue%20%0D%0Adocument.calc.display.value%3Ddecto(mem%2Ccarry)%20%0D%0A%7D%20%0D%0A%0D%0Afunction%20putmemory()%20%0D%0A%7B%20%0D%0AendNumber%3Dtrue%20%0D%0Aif%20(document.calc.display.value!%3D0)%20%0D%0A%7B%20%0D%0Amem%3Dtodec(document.calc.display.value%2Ccarry)%20%0D%0Adocument.calc.memory.value%3D%22%20M%20%22%20%0D%0A%7D%20%0D%0Aelse%20%0D%0Adocument.calc.memory.value%3D%22%20%20%20%22%20%0D%0A%7D%20%0D%0A%0D%0Afunction%20addmemory()%20%0D%0A%7B%20%0D%0AendNumber%3Dtrue%20%0D%0Amem%3DparseFloat(mem)%2BparseFloat(todec(document.calc.display.value%2Ccarry))%20%0D%0Aif%20(mem%3D%3D0)%20%0D%0Adocument.calc.memory.value%3D%22%20%20%20%22%20%0D%0Aelse%20%0D%0Adocument.calc.memory.value%3D%22%20M%20%22%20%0D%0A%7D%20%0D%0A%0D%0Afunction%20multimemory()%20%0D%0A%7B%20%0D%0AendNumber%3Dtrue%20%0D%0Amem%3DparseFloat(mem)*parseFloat(todec(document.calc.display.value%2Ccarry))%20%0D%0Aif%20(mem%3D%3D0)%20%0D%0Adocument.calc.memory.value%3D%22%20%20%20%22%20%0D%0Aelse%20%0D%0Adocument.calc.memory.value%3D%22%20M%20%22%20%0D%0A%7D%20%0D%0A%0D%0A%2F%2F%E5%8D%81%E8%BF%9B%E5%88%B6%E8%BD%AC%E6%8D%A2%20%0D%0A%0D%0Afunction%20todec(num%2Coldcarry)%20%0D%0A%7B%20%0D%0Aif%20(oldcarry%3D%3D10%20%7C%7C%20num%3D%3D0)%20return(num)%20%0D%0Avar%20neg%3D(num.charAt(0)%3D%3D%22-%22)%20%0D%0Aif%20(neg)%20num%3Dnum.substr(1)%20%0D%0Avar%20newnum%3D0%20%0D%0Afor%20(var%20index%3D1%3Bindex%3C%3Dnum.length%3Bindex%2B%2B)%20%0D%0Anewnum%3Dnewnum*oldcarry%2Bhexnum.indexOf(num.charAt(index-1))%20%0D%0Aif%20(neg)%20%0D%0Anewnum%3D-newnum%20%0D%0Areturn(newnum)%20%0D%0A%7D%20%0D%0A%0D%0Afunction%20decto(num%2Cnewcarry)%20%0D%0A%7B%20%0D%0Avar%20neg%3D(num%3C0)%20%0D%0Aif%20(newcarry%3D%3D10%20%7C%7C%20num%3D%3D0)%20return(num)%20%0D%0Anum%3D%22%22%2BMath.abs(num)%20%0D%0Avar%20newnum%3D%22%22%20%0D%0Awhile%20(num!%3D0)%20%0D%0A%7B%20%0D%0Anewnum%3Dhexnum.charAt(num%25newcarry)%2Bnewnum%20%0D%0Anum%3DMath.floor(num%2Fnewcarry)%20%0D%0A%7D%20%0D%0Aif%20(neg)%20%0D%0Anewnum%3D%22-%22%2Bnewnum%20%0D%0Areturn(newnum)%20%0D%0A%7D%20%0D%0A%0D%0A%2F%2F%E8%A1%A8%E8%BE%BE%E5%BC%8F%E8%A7%A3%E6%9E%90%20%0D%0A%0D%0Afunction%20parse(string)%20%0D%0A%7B%20%0D%0Aif%20(string.match(%2F%5E(.*%5Cd%5B%5C%2B%5C-%5C*%5C%2F%5C%25%5C%5E%5C%26%5C%7Cx%5C%3C%5D)%3F(%5B%2B-%5D%3F%5B0-9a-f%5C.%5D%2B)(%5B%5C%2B%5C-%5C*%5C%2F%5C%25%5C%5E%5C%26%5C%7Cx%5C%3C%5D)(%5B%2B-%5D%3F%5B0-9a-f%5C.%5D%2B)%24%2F))%20%0D%0Areturn(RegExp.%241%2Bcypher(RegExp.%242%2CRegExp.%243%2CRegExp.%244))%20%0D%0Aelse%20%0D%0Areturn(string)%20%0D%0A%7D%20%0D%0A%0D%0A%2F%2F%E6%95%B0%E5%AD%A6%E8%BF%90%E7%AE%97%E5%92%8C%E4%BD%8D%E8%BF%90%E7%AE%97%20%0D%0A%0D%0Afunction%20cypher(left%2Cjoin%2Cright)%20%0D%0A%7B%20%0D%0Aleft%3Dtodec(left%2Ccarry)%20%0D%0Aright%3Dtodec(right%2Ccarry)%20%0D%0Aif%20(join%3D%3D%22%2B%22)%20%0D%0Areturn(decto(parseFloat(left)%2BparseFloat(right)%2Ccarry))%20%0D%0Aif%20(join%3D%3D%22-%22)%20%0D%0Areturn(decto(left-right%2Ccarry))%20%0D%0Aif%20(join%3D%3D%22*%22)%20%0D%0Areturn(decto(left*right%2Ccarry))%20%0D%0Aif%20(join%3D%3D%22%2F%22%20%26%26%20right!%3D0)%20%0D%0Areturn(decto(left%2Fright%2Ccarry))%20%0D%0Aif%20(join%3D%3D%22%25%22)%20%0D%0Areturn(decto(left%25right%2Ccarry))%20%0D%0Aif%20(join%3D%3D%22%26%22)%20%0D%0Areturn(decto(left%26right%2Ccarry))%20%0D%0Aif%20(join%3D%3D%22%7C%22)%20%0D%0Areturn(decto(left%7Cright%2Ccarry))%20%0D%0Aif%20(join%3D%3D%22%5E%22)%20%0D%0Areturn(decto(Math.pow(left%2Cright)%2Ccarry))%20%0D%0Aif%20(join%3D%3D%22x%22)%20%0D%0Areturn(decto(left%5Eright%2Ccarry))%20%0D%0Aif%20(join%3D%3D%22%3C%22)%20%0D%0Areturn(decto(left%3C%3Cright%2Ccarry))%20%0D%0Aalert(%22%E9%99%A4%E6%95%B0%E4%B8%8D%E8%83%BD%E4%B8%BA%E9%9B%B6%22)%20%0D%0Areturn(left)%20%0D%0A%7D%20%0D%0A%0D%0A%2F%2F%E5%87%BD%E6%95%B0%E8%AE%A1%E7%AE%97%20%0D%0A%0D%0Afunction%20funcalc(fun%2Cnum)%20%0D%0A%7B%20%0D%0Awith(Math)%20%0D%0A%7B%20%0D%0Aif%20(fun%3D%3D%22pi%22)%20%0D%0Areturn(PI)%20%0D%0Aif%20(fun%3D%3D%22e%22)%20%0D%0Areturn(E)%20%0D%0A%0D%0Aif%20(fun%3D%3D%22abs%22)%20%0D%0Areturn(abs(num))%20%0D%0Aif%20(fun%3D%3D%22ceil%22)%20%0D%0Areturn(ceil(num))%20%0D%0Aif%20(fun%3D%3D%22round%22)%20%0D%0Areturn(round(num))%20%0D%0A%0D%0Aif%20(fun%3D%3D%22floor%22)%20%0D%0Areturn(floor(num))%20%0D%0Aif%20(fun%3D%3D%22deci%22)%20%0D%0Areturn(num-floor(num))%20%0D%0A%0D%0A%0D%0Aif%20(fun%3D%3D%22ln%22%20%26%26%20num%3E0)%20%0D%0Areturn(log(num))%20%0D%0Aif%20(fun%3D%3D%22exp%22)%20%0D%0Areturn(exp(num))%20%0D%0Aif%20(fun%3D%3D%22log%22%20%26%26%20num%3E0)%20%0D%0Areturn(log(num)*LOG10E)%20%0D%0Aif%20(fun%3D%3D%22expdec%22)%20%0D%0Areturn(pow(10%2Cnum))%20%0D%0A%0D%0A%0D%0Aif%20(fun%3D%3D%22cube%22)%20%0D%0Areturn(num*num*num)%20%0D%0Aif%20(fun%3D%3D%22cubt%22)%20%0D%0Areturn(pow(num%2C1%2F3))%20%0D%0Aif%20(fun%3D%3D%22sqr%22)%20%0D%0Areturn(num*num)%20%0D%0Aif%20(fun%3D%3D%22sqrt%22%20%26%26%20num%3E%3D0)%20%0D%0Areturn(sqrt(num))%20%0D%0A%0D%0Aif%20(fun%3D%3D%22!%22)%20%0D%0Areturn(factorial(num))%20%0D%0A%0D%0Aif%20(fun%3D%3D%22recip%22%20%26%26%20num!%3D0)%20%0D%0Areturn(1%2Fnum)%20%0D%0A%0D%0Aif%20(fun%3D%3D%22dms%22)%20%0D%0Areturn(dms(num))%20%0D%0Aif%20(fun%3D%3D%22deg%22)%20%0D%0Areturn(deg(num))%20%0D%0A%0D%0Aif%20(fun%3D%3D%22~%22)%20%0D%0Areturn(~num)%20%0D%0A%0D%0Aif%20(angle%3D%3D%22d%22)%20%0D%0A%7B%20%0D%0Aif%20(fun%3D%3D%22sin%22)%20%0D%0Areturn(sin(degressToRadians(num)))%20%0D%0Aif%20(fun%3D%3D%22cos%22)%20%0D%0Areturn(cos(degressToRadians(num)))%20%0D%0Aif%20(fun%3D%3D%22tan%22)%20%0D%0Areturn(tan(degressToRadians(num)))%20%0D%0A%0D%0Aif%20(fun%3D%3D%22arcsin%22%20%26%26%20abs(num)%3C%3D1)%20%0D%0Areturn(radiansToDegress(asin(num)))%20%0D%0Aif%20(fun%3D%3D%22arccos%22%20%26%26%20abs(num)%3C%3D1)%20%0D%0Areturn(radiansToDegress(acos(num)))%20%0D%0Aif%20(fun%3D%3D%22arctan%22)%20%0D%0Areturn(radiansToDegress(atan(num)))%20%0D%0A%7D%20%0D%0Aelse%20%0D%0A%7B%20%0D%0Aif%20(fun%3D%3D%22sin%22)%20%0D%0Areturn(sin(num))%20%0D%0Aif%20(fun%3D%3D%22cos%22)%20%0D%0Areturn(cos(num))%20%0D%0Aif%20(fun%3D%3D%22tan%22)%20%0D%0Areturn(tan(num))%20%0D%0A%0D%0Aif%20(fun%3D%3D%22arcsin%22%20%26%26%20abs(num)%3C%3D1)%20%0D%0Areturn(asin(num))%20%0D%0Aif%20(fun%3D%3D%22arccos%22%20%26%26%20abs(num)%3C%3D1)%20%0D%0Areturn(acos(num))%20%0D%0Aif%20(fun%3D%3D%22arctan%22)%20%0D%0Areturn(atan(num))%20%0D%0A%7D%20%0D%0A%0D%0Aif%20(fun%3D%3D%22hypsin%22)%20%0D%0Areturn((exp(num)-exp(0-num))*0.5)%20%0D%0Aif%20(fun%3D%3D%22hypcos%22)%20%0D%0Areturn((exp(num)%2Bexp(-num))*0.5)%20%0D%0Aif%20(fun%3D%3D%22hyptan%22)%20%0D%0Areturn((exp(num)-exp(-num))%2F(exp(num)%2Bexp(-num)))%20%0D%0A%0D%0Aif%20(fun%3D%3D%22ahypsin%22%20%7C%20fun%3D%3D%22hypcos%22%20%7C%20fun%3D%3D%22hyptan%22)%20%0D%0A%7B%20%0D%0Aalert(%22%E5%AF%B9%E4%B8%8D%E8%B5%B7%2C%E5%85%AC%E5%BC%8F%E8%BF%98%E6%B2%A1%E6%9C%89%E6%9F%A5%E5%88%B0!%22)%20%0D%0Areturn(num)%20%0D%0A%7D%20%0D%0A%0D%0Aalert(%22%E8%B6%85%E5%87%BA%E5%87%BD%E6%95%B0%E5%AE%9A%E4%B9%89%E8%8C%83%E5%9B%B4%22)%20%0D%0Areturn(num)%20%0D%0A%7D%20%0D%0A%7D%20%0D%0A%0D%0Afunction%20factorial(n)%20%0D%0A%7B%20%0D%0An%3DMath.abs(parseInt(n))%20%0D%0Avar%20fac%3D1%20%0D%0Afor%20(%3Bn%3E0%3Bn-%3D1)%20%0D%0Afac*%3Dn%20%0D%0Areturn(fac)%20%0D%0A%7D%20%0D%0A%0D%0Afunction%20dms(n)%20%0D%0A%7B%20%0D%0Avar%20neg%3D(n%3C0)%20%0D%0Awith(Math)%20%0D%0A%7B%20%0D%0An%3Dabs(n)%20%0D%0Avar%20d%3Dfloor(n)%20%0D%0Avar%20m%3Dfloor(60*(n-d))%20%0D%0Avar%20s%3D(n-d)*60-m%20%0D%0A%7D%20%0D%0Avar%20dms%3Dd%2Bm%2F100%2Bs*0.006%20%0D%0Aif%20(neg)%20%0D%0Adms%3D-dms%20%0D%0Areturn(dms)%20%0D%0A%7D%20%0D%0A%0D%0Afunction%20deg(n)%20%0D%0A%7B%20%0D%0Avar%20neg%3D(n%3C0)%20%0D%0Awith(Math)%20%0D%0A%7B%20%0D%0An%3Dabs(n)%20%0D%0Avar%20d%3Dfloor(n)%20%0D%0Avar%20m%3Dfloor((n-d)*100)%20%0D%0Avar%20s%3D(n-d)*100-m%20%0D%0A%7D%20%0D%0Avar%20deg%3Dd%2Bm%2F60%2Bs%2F36%20%0D%0Aif%20(neg)%20%0D%0Adeg%3D-deg%20%0D%0Areturn(deg)%20%0D%0A%7D%20%0D%0A%0D%0Afunction%20degressToRadians(degress)%20%0D%0A%7B%20%0D%0Areturn(degress*Math.PI%2F180)%20%0D%0A%7D%20%0D%0A%0D%0Afunction%20radiansToDegress(radians)%20%0D%0A%7B%20%0D%0Areturn(radians*180%2FMath.PI)%20%0D%0A%7D%20%0D%0A%0D%0A%2F%2F%E7%95%8C%E9%9D%A2%20%0D%0A%0D%0A%2F%2F--%3E%20%0D%0A%20%20%3C%2FSCRIPT%3E"> <DIV align=center> <CENTER> <table id=AutoNumber2 style="BORDER-COLLAPSE: collapse" borderColor=#808080 cellSpacing=0 cellPadding=0 width=760 border=0> <TBODY> <TR> <table id=AutoNumber5 style="BORDER-COLLAPSE: collapse" borderColor=#808080 height=30 cellSpacing=0 cellPadding=0 width="93%" border=0> <TBODY> <TD align=middle width="100%" bgColor=#dbe8d2 height=30> <P> <DIV align=center> <FORM name=calc> <table height=250 width=500 border=0> <TBODY> <TR> <TD bgColor=#ecf4ec height=50> <table width=500> <TBODY> <TR> <TD width=486> <DIV align=center><INPUT readOnly size=67 value=0 name=display></DIV></TD></TR></TBODY></TABLE></TD></TR> <TR> <TD bgColor=#ecf4ec> <table width=500> <TBODY> <TR> <TD width=290><INPUT onclick=inputChangCarry(16) type=radio name=carry> 十六进制 <INPUT onclick=inputChangCarry(10) type=radio CHECKED name=carry> 十进制 <INPUT onclick=inputChangCarry(8) type=radio name=carry> 八进制 <INPUT onclick=inputChangCarry(2) type=radio name=carry> 二进制 </TD> <TD></TD> <TD width=135><INPUT onclick="inputChangAngle('d')" type=radio CHECKED value=d name=angle> 角度制 <INPUT onclick="inputChangAngle('r')" type=radio value=r name=angle> 弧度制 </TD></TR></TBODY></TABLE> <table width=500> <TBODY> <TR> <TD width=170><INPUT onclick=inputshift() type=checkbox value=ON name=shiftf>上档功能 <INPUT onclick=inputshift() type=checkbox value=ON name=hypf>双曲函数 </TD> <TD><INPUT style="BACKGROUND-COLOR: lightgrey" readOnly size=3 name=bracket> <INPUT style="BACKGROUND-COLOR: lightgrey" readOnly size=3 name=memory> <INPUT style="BACKGROUND-COLOR: lightgrey" readOnly size=3 name=operator> </TD> <TD width=183><INPUT style="COLOR: red" onclick=backspace() type=button value=" 退格 "> <INPUT style="COLOR: red" onclick="document.calc.display.value = 0 " type=button value=" 清屏 "> <INPUT style="COLOR: red" onclick=clearall() type=button value=" 全清"> </TD></TR></TBODY></TABLE> <table width=500> <TBODY> <TR> <TD> <table> <TBODY> <TR align=middle> <TD><INPUT style="COLOR: blue" onclick="inputfunction('pi','pi')" type=button value=" PI " name=pi> </TD> <TD><INPUT style="COLOR: blue" onclick="inputfunction('e','e')" type=button value=" E " name=e> </TD> <TD><INPUT style="COLOR: #ff00ff" onclick="inputfunction('dms','deg')" type=button value=d.ms name=bt> </TD></TR> <TR align=middle> <TD><INPUT style="COLOR: #ff00ff" onclick=addbracket() type=button value=" ( "> </TD> <TD><INPUT style="COLOR: #ff00ff" onclick=disbracket() type=button value=" ) "> </TD> <TD><INPUT style="COLOR: #ff00ff" onclick="inputfunction('ln','exp')" type=button value=" ln " name=ln> </TD></TR> <TR align=middle> <TD><INPUT style="COLOR: #ff00ff" onclick="inputtrig('sin','arcsin','hypsin','ahypsin')" type=button value="sin " name=sin> </TD> <TD><INPUT style="COLOR: #ff00ff" onclick="operation('^',7)" type=button value="x^y "> </TD> <TD><INPUT style="COLOR: #ff00ff" onclick="inputfunction('log','expdec')" type=button value="log " name=log> </TD></TR> <TR align=middle> <TD><INPUT style="COLOR: #ff00ff" onclick="inputtrig('cos','arccos','hypcos','ahypcos')" type=button value="cos " name=cos> </TD> <TD><INPUT style="COLOR: #ff00ff" onclick="inputfunction('cube','cubt')" type=button value="x^3 " name=cube> </TD> <TD><INPUT style="COLOR: #ff00ff" onclick="inputfunction('!','!')" type=button value=" n! "> </TD></TR> <TR align=middle> <TD><INPUT style="COLOR: #ff00ff" onclick="inputtrig('tan','arctan','hyptan','ahyptan')" type=button value="tan " name=tan> </TD> <TD><INPUT style="COLOR: #ff00ff" onclick="inputfunction('sqr','sqrt')" type=button value="x^2 " name=sqr> </TD> <TD><INPUT style="COLOR: #ff00ff" onclick="inputfunction('recip','recip')" type=button value="1/x "> </TD></TR></TBODY></TABLE></TD> <TD width=30></TD> <TD> <table> <TBODY> <TR> <TD><INPUT style="COLOR: red" onclick=putmemory() type=button value=" 储存 "> </TD></TR> <TR> <TD><INPUT style="COLOR: red" onclick=getmemory() type=button value=" 取存 "> </TD></TR> <TR> <TD><INPUT style="COLOR: red" onclick=addmemory() type=button value=" 累存 "> </TD></TR> <TR> <TD><INPUT style="COLOR: red" onclick=multimemory() type=button value=" 积存 "> </TD></TR> <TR> <TD height=33><INPUT style="COLOR: red" onclick=clearmemory() type=button value=" 清存 "> </TD></TR></TBODY></TABLE></TD> <TD width=30></TD> <TD> <table> <TBODY> <TR align=middle> <TD><INPUT style="COLOR: blue" onclick="inputkey('7')" type=button value=" 7 " name=k7> </TD> <TD><INPUT style="COLOR: blue" onclick="inputkey('8')" type=button value=" 8 " name=k8> </TD> <TD><INPUT style="COLOR: blue" onclick="inputkey('9')" type=button value=" 9 " name=k9> </TD> <TD><INPUT style="COLOR: red" onclick="operation('/',6)" type=button value=" / "> </TD> <TD><INPUT style="COLOR: red" onclick="operation('%',6)" type=button value=取余> </TD> <TD><INPUT style="COLOR: red" onclick="operation('&',3)" type=button value=" 与 "> </TD></TR> <TR align=middle> <TD><INPUT style="COLOR: blue" onclick="inputkey('4')" type=button value=" 4 " name=k4> </TD> <TD><INPUT style="COLOR: blue" onclick="inputkey('5')" type=button value=" 5 " name=k5> </TD> <TD><INPUT style="COLOR: blue" onclick="inputkey('6')" type=button value=" 6 " name=k6> </TD> <TD><INPUT style="COLOR: red" onclick="operation('*',6)" type=button value=" * "> </TD> <TD><INPUT style="COLOR: red" onclick="inputfunction('floor','deci')" type=button value=取整 name=floor> </TD> <TD><INPUT style="COLOR: red" onclick="operation('|',1)" type=button value=" 或 "> </TD></TR> <TR align=middle> <TD><INPUT style="COLOR: blue" onclick="inputkey('1')" type=button value=" 1 "> </TD> <TD><INPUT style="COLOR: blue" onclick="inputkey('2')" type=button value=" 2 " name=k2> </TD> <TD><INPUT style="COLOR: blue" onclick="inputkey('3')" type=button value=" 3 " name=k3> </TD> <TD><INPUT style="COLOR: red" onclick="operation('-',5)" type=button value=" - "> </TD> <TD><INPUT style="COLOR: red" onclick="operation('<',4)" type=button value=左移> </TD> <TD><INPUT style="COLOR: red" onclick="inputfunction('~','~')" type=button value=" 非 "> </TD></TR> <TR align=middle> <TD><INPUT style="COLOR: blue" onclick="inputkey('0')" type=button value=" 0 "> </TD> <TD><INPUT style="COLOR: blue" onclick=changeSign() type=button value=+/-> </TD> <TD><INPUT style="COLOR: blue" onclick="inputkey('.')" type=button value=" . " name=kp> </TD> <TD><INPUT style="COLOR: red" onclick="operation('+',5)" type=button value=" + "> </TD> <TD><INPUT style="COLOR: red" onclick=result() type=button value=" = "> </TD> <TD><INPUT style="COLOR: red" onclick="operation('x',2)" type=button value=异或> </TD></TR> <TR align=middle> <TD><INPUT style="COLOR: blue" disabled onclick="inputkey('a')" type=button value=" A " name=ka> </TD> <TD><INPUT style="COLOR: blue" disabled onclick="inputkey('b')" type=button, value=" B " name=kb> </TD> <TD><INPUT style="COLOR: blue" disabled onclick="inputkey('c')" type=button value=" C " name=kc> </TD> <TD><INPUT style="COLOR: blue" disabled onclick="inputkey('d')" type=button value=" D " name=kd> </TD> <TD><INPUT style="COLOR: blue" disabled onclick="inputkey('e')" type=button value=" E " name=ke> </TD> <TD><INPUT style="COLOR: blue" disabled onclick="inputkey('f')" type=button value=" F " name=kf> </TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></FORM></DIV> </CENTER></BODY></HTML>
[Ctrl+A 全选 注:
如需引入外部Js需刷新才能执行
]
教程首页
更多教程