网站建站第十四课,东莞企业网站推广,建站需要哪些东西,购物网站建设案例嗨#xff0c;大家好#xff0c;今天给大家带来的是一个计算器首先要知道我们常用的计算器都有哪些按键#xff0c;有0~9#xff0c; , - , *, /#xff0c;还有 和.#xff0c;基本是这些按键#xff0c;然后我们去创建一些按键。之后我们去设置样式#xff0c;设置完…嗨大家好今天给大家带来的是一个计算器首先要知道我们常用的计算器都有哪些按键有0~9 , - , *, /还有 和.基本是这些按键然后我们去创建一些按键。之后我们去设置样式设置完去js里写数据获取上面的inputvar text document.querySelector(input[type text])获取box下所有的inputvar bts document.querySelectorAll(.box input)获取boxvar box document.querySelector(.box) 获取app下的inputvar dengyu document.querySelector(#app input[type button])获取inputvar nulll document.querySelector(#app input[type null])设置点击事件box.onclick function(e){ 兼容 var e e ||window.event; 让ie6兼容 var tar e.target||e.srcElement; 如果点击的的name全等于input if(tar.nodeName INPUT){就把text的内容写到tar里 text.value tar.value; }}等于的点击事件dengyu.onclick function(){ 点击之后开始运算 text.value eval(text.value);}清除的点击事件nulll.onclick function(){ 点击一下就清除 text.value null;}ok最后我们看一下结果哈哈哈 可能有点丑不要介意哈~