最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
js 计算器实例代码
时间:2022-11-14 22:02:59 编辑:袖梨 来源:一聚教程网
YPE html PUBLIC "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w***3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd">
js 计算器
document.onkeyup = function(e)
{
var evt = utils.fixevent(e);if ((evt.keycode >= 48 && evt.keycode (evt.keycode >= 96 && evt.keycode {
if (evt.keycode > 57)
{
calculator.input(evt.keycode - 96);
}
else
{
calculator.input(evt.keycode - 48);
}
}
else if ((evt.keycode == 107 && !evt.shiftkey) || (evt.keycode == 61 && evt.shiftkey) || (evt.keycode == 187 && evt.shiftkey))
{
calculator.calculate('+');
}
else if ((evt.keycode == 109 && !evt.shiftkey) || (evt.keycode == 189 && !evt.shiftkey))
{
calculator.calculate('-');
}
else if ((evt.keycode == 106 && !evt.shiftkey) || (evt.keycode == 56 && evt.shiftkey))
{
calculator.calculate('*');
}
else if ((evt.keycode == 111 && !evt.shiftkey) || (evt.keycode == 191 && !evt.shiftkey))
{
calculator.calculate('/');
}
else if (evt.keycode == 13 || (evt.keycode == 61 && !evt.shiftkey) || (evt.keycode == 187 && !evt.shiftkey))
{
calculator.calculate('=');
}
else if ((evt.keycode == 110 && !evt.shiftkey) || (evt.keycode == 190 && !evt.shiftkey))
{
calculator.input('.');
}
else if (evt.keycode == 27)
{
calculator.clear();
}
else if (evt.keycode == 8)
{
calculator.backspace();
}return false;
//alert(evt.keycode);
}
//-->
相关文章
- 新三国志曹操传马超无双试炼四通关攻略 12-15
- 俄罗斯YANDEX引擎官网入口-免登录直达Yandex首页 12-15
- 漫蛙ManWa在线免费阅读入口_漫蛙ManWa官方网页版一键直达 12-15
- 逃离鸭科夫仓库区地窖在哪 仓库区地窖入口位置详情 12-15
- 光与影33号远征队熙艾尔bd玩法:熙艾尔毕业装备与加点思路介绍 12-15
- 漫蛙网页版免费入口进不去-漫蛙网页版最新免费版一键直达 12-15