html实现计算器源码

作者:xcLeigh
文章地址:https://blog.csdn.net/weixin_43151418/article/details/134532725


html实现计算器源码,计算器源码,简易计算器功能实现,加减乘除,平方,根号等基本算数功能实现,代码上手简单,代码独立,可以直接使用。也可直接预览效果。

1.设计来源

1.1 主界面

    主界面,简易计算器,可以切换主题,实现了基本的加减乘除,平方根号等功能。

请添加图片描述

1.2 计算效果界面

    计算效果界面,第一行是计算公式,第二行是结果。

请添加图片描述

2.效果和源码

2.1 动态效果

    这里是完整的效果演示,可在此代码基础上更加完善功能,支持扩展自己的风格,可以删减内容,打造属于自己的计算器。
在这里插入图片描述

2.2 源代码

    这里是主界面的代码,其他图片、js、css等代码,见下面的 源码下载 ,里面有所有代码资源和相关说明。

<!DOCTYPE html>
<html lang="zh">
<head>
	<meta charset="UTF-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> 
	<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
	<title>计算器 - xcLeigh</title>
	<link rel="stylesheet" type="text/css" href="js/bootstrap.min.css" />
	<link rel="stylesheet" href="css/style.css">
	<link href="images/favicon.png" rel="icon">
</head>
<body style="overflow: hidden;">
	<div class="htmleaf-container" style="overflow: hidden;">
		<div style="margin:2em 0;">
		<div class="container">
			<div style="display: flex;justify-content: center;align-items: center; width: 100%; ">
				<div class="titleSpan">计算器</div>
	            <!-- Rounded switch -->
	            <label class="switch">
	                <input type="checkbox">
	                <span class="slider"></span>
	            </label>
			</div>
	            <form>
	                <input readonly id="display1" type="text" class="form-control-lg text-right">
	                <input readonly id="display2" type="text" class="form-control-lg text-right" style="font-weight: bold;">
	            </form>
	            
	            <div class="d-flex justify-content-between button-row">
	                <button id="clear" type="button">&#67;</button>
	                <button id="left-parenthesis" type="button" class="operator-group">&#40;</button>
	                <button id="right-parenthesis" type="button" class="operator-group">&#41;</button>
	                <button id="backspace" type="button">&#9003;</button>
	            </div>
	          
	            <div class="d-flex justify-content-between button-row">
	                <button id="square-root" type="button" class="operator-group">&#8730;</button>
	                <button id="square" type="button" class="operator-group">&#120;&#178;</button>
	                <button id="ans" type="button" class="operator-group">&#65;&#110;&#115;</button>
	                <button id="divide" type="button" class="operator-group">&#247;</button>
	            </div>
	            

	            <div class="d-flex justify-content-between button-row">
	                <button id="seven" type="button" class="operand-group">&#55;</button>
	                <button id="eight" type="button" class="operand-group">&#56;</button>
	                <button id="nine" type="button" class="operand-group">&#57;</button>
	                <button id="multiply" type="button" class="operator-group">&#215;</button>
	            </div>
	        
	            
	            <div class="d-flex justify-content-between button-row">
	                <button id="four" type="button" class="operand-group">&#52;</button>
	                <button id="five" type="button" class="operand-group">&#53;</button> 
	                <button id="six" type="button" class="operand-group">&#54;</button> 
	                <button id="subtract" type="button" class="operator-group">&#8722;</button>
	            </div>
	     
	            
	            <div class="d-flex justify-content-between button-row">
	                <button id="one" type="button" class="operand-group">&#49;</button> 
	                <button id="two" type="button" class="operand-group">&#50;</button>
	                <button id="three" type="button" class="operand-group">&#51;</button>
	                <button id="add" type="button" class="operator-group">&#43;</button>
	            </div>

	            <div class="d-flex justify-content-between button-row">
	                <button id="percentage" type="button" class="operand-group">&#37;</button>
	                <button id="zero" type="button" class="operand-group">&#48;</button>
	                <button id="decimal" type="button" class="operand-group">&#46;</button>
	                <button id="equal" type="button" class="ans-dark">&#61;</button>
	            </div>

	        </div>
	        </div>
	</div>
	
	<script src="js/jquery-1.11.0.min.js" type="text/javascript"></script>
	<script src="js/math.min.js"></script>
	<script src="js/popper.min.js"></script>
	<script type="text/javascript" src="js/bootstrap.min.js"></script>
	<script src="js/main.js" type="text/javascript"></script>
</body>
</html>

源码下载

html实现计算器(源码) 点击下载
在这里插入图片描述


     💢 关注博主 带你实现畅游前后端

     🏰 加入社区 带你体验马航不孤单

     💯 神秘个人简介 带你体验不一样得介绍

     💘 为爱表白 为你那个TA,体验别致的浪漫惊喜

     🎀 酷炫邀请函 带你体验高大上得邀请


     ① 🉑提供云服务部署(有自己的阿里云);
     ② 🉑提供前端、后端、应用程序、H5、小程序、公众号等相关业务;
     如🈶合作请联系我,期待您的联系。
    :本文撰写于CSDN平台,作者:xcLeigh(所有权归作者所有),https://blog.csdn.net/weixin_43151418,如果相关下载没有跳转,请查看这个地址,相关链接没有跳转,皆是抄袭本文,转载请备注本文原地址。


     亲,码字不易,动动小手,欢迎 点赞 ➕ 收藏,如 🈶 问题请留言(评论),博主看见后一定及时给您答复,💌💌💌


原文地址:https://blog.csdn.net/weixin_43151418/article/details/134532725(防止抄袭,原文地址不可删除)

  • 4
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

xcLeigh

万水千山总是情,打赏两块行不行

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值