




已阅读5页,还剩3页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
简单的计算器 1 2 Javascript代码 varnum 0 result 0 numshow 0 varoperate 0 判断输入状态的标志varcalcul 0 判断计算状态的标志varquit 0 防止重复按键的标志functioncommand num varstr String document calculator numScreen value 获得当前显示数据str str 0 operate 0 str 如果当前值不是 0 且状态为0 则返回当前值 否则返回空值 str str String num 给当前值追加字符document calculator numScreen value str 刷新显示operate 0 重置输入状态quit 0 重置防止重复按键的标志 functiondzero varstr String document calculator numScreen value str str 0 operate 0 str 00 0 0 如果当前值不是 0 且状态为0 则返回当str 00 否则返回 0 document calculator numScreen value str operate 0 functiondot varstr String document calculator numScreen value str str 0 operate 0 str 0 0 如果当前值不是 0 且状态为0 则返回当前值 否则返回 0 for i 0 i str length i 判断是否已经有一个点号if str substr i 1 returnfalse 如果有则不再插入 str str document calculator numScreen value str operate 0 functiondel 退格varstr String document calculator numScreen value str str 0 str str str substr 0 str length 1 str str str 0 document calculator numScreen value str functionclearscreen 清除数据num 0 result 0 numshow 0 document calculator numScreen value 0 functionplus 加法calculate 调用计算函数operate 1 更改输入状态calcul 1 更改计算状态为加 functionminus 减法calculate operate 1 calcul 2 functiontimes 乘法calculate operate 1 calcul 3 functiondivide 除法calculate operate 1 calcul 4 functionpersent 求余calculate operate 1 calcul 5 functionequal calculate 等于operate 1 num 0 result 0 numshow 0 functioncalculate numshow Number document calculator numScreen value if num 0 3 Html代码 写给新手 js表单操作 四 简单计算器 二 body font size 12px font family Arial Georgia TimesNewRoman Times serif color 555 text align center background color e2e2e2 h6 margin 0 font size 12px calculator width 240px height auto overflow hidden margin 10pxauto border fff1pxsolid padding bottom 10px background color f2f2f2 calculatordiv clear both calculatorul padding 0 margin 5px14px border fff1pxsolid height auto overflow hidden calculatorli list style none float left width 32px height 32px margin 5px display inline line height 32px font size 14px background color eaeaea calculatorli tool background color e2e2e2 calculatorli hover background color f9f9f9 cursor pointer calculatorli active background color fc0 cursor pointer calculatorli tool active background color d8e8ff cursor pointer calcu head text align left padding 10px15px5px span imyeah float right color ccc span imyeaha color ccc screen width 200px height 24px line height 24px padding 4px border e6e6e61pxsolid border bottom f2f2f21pxsolid border right f2f2f21pxsolid margin 10pxauto direction ltr text align right font size 16px color 999 calcu foot text align left padding 10px15px5px height auto overflow hidden span note float left width 210px height auto overflow hidden color red span welcome clear both color 999 span welcomea float right color 999 此处插入上面的js代码 I mYeah 简单的计算器789 C456 123 000 欢迎使用javascript计算器 反馈 4 5 HTML 简单的计算器 walker欢迎使用JavaScript计算器反馈 6 CSS Basicreset margin 0 padding 0 box sizing border box font 14pxArial sans serif html height 100 background color lightslategrey calculator margin 15pxauto width 330px height 400px border 1pxsolidlightgray background color darkgrey padding 15px LOGO LOGO height 20px LOGO name float left line height 30px LOGO verson float right line height 30px screen shuRu margin top 15px screen margin top 5px width 300px height 40px text align right padding right 10px font size 20px keys border 1pxsolidlightgray height 223px margin top 25px padding 8px keys last margin right 0px footer margin top 20px height 20px footer link float right keys buttons float left width 42px height 36px text align center background color lightgray margin 017px20px0 7 Javascript varnum 0 定义第一个输入的数据functionjsq num 获取当前输入if num document getElementById screenName value Math round document getElementById screenName value 100 else document getElementById screenName value document getElementById num value functioneva 计算输入结果document getElementById screenName value eval document getElementById screenName value functionc
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 【《第三方物流参与企业供应链整合的研究-以日立电梯概述为例》5800字(论文)】
- 克银丸市场定位分析-洞察及研究
- 2025年缓解压力保健品行业研究报告及未来发展趋势预测
- 2025年滑触线行业研究报告及未来发展趋势预测
- 2025年烘焙酶制剂行业研究报告及未来发展趋势预测
- 2025年户用热量表行业研究报告及未来发展趋势预测
- 2025年公交地铁App行业研究报告及未来发展趋势预测
- 大理石堆场租赁及石材加工出口合同
- 劳动合同中止期间的员工关怀与心理疏导协议
- 跨国公司抵冲货款及资金结算规范合同
- 车辆维修延保协议书(2篇)
- 应知应会设备安全操作培训
- 智能监控系统技术方案
- 卫健局报告范文
- 汉语语法课件教学课件
- 沪教版四年级上册数学应用题专项水平练习题
- 汉谟拉比法典中文版
- 卡乐控制器PCO控制器说明
- GB/T 44620-2024苹果及苹果制品中根皮苷的检测方法高效液相色谱法
- 湘教版七年级数学上册 1.7 有理数的混合运算(第一章 有理数 学习、上课课件)
- 2024年海南省中考物理试题卷(含答案)
评论
0/150
提交评论