计算器html5+css3+jQuery实现

下载地址:https://download.csdn.net/download/qq_31674229/10277981

小弟在面试中遇到一个前端的问题,公司采取的是机试,共有三个问题。

  1. 简单的排序,敲敲代码,就搞定。
  2. 创建两个线程,分别对数据进行操作。考察的是线程的使用。(继承Thread类和实现Runnable接口)
  3. 使用html5+css3+jQuery实现一个计算器。设计图如下:(公司给的没这个美观)

由于时间有限,计算器实现了页面的排版,计算逻辑未实现,回来特别琢磨下,做了一个美观的出来。

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title>计算器</title>
		<link rel="stylesheet" href="css/common.css"/>
		<link rel="stylesheet" href="css/font-awesome.min.css"/>
	</head>
	<body>
		<div class="wrap" id="wrap">
			<div class="wrap_top">
				<span class="slider" id="slider"></span>
			</div>
			<div class="wrap_center">
				<input type="text" readonly id="display1" class="input_control_lg input_light text_right"/>
				<input type="text" readonly id="display2" class="input_control_lg input_light text_right"/>
			</div>
			<div class="wrap_footer">
				<div class="div_flex div_justify_content div_row">
					<button type="button" id="left_parenthesis" class="operate_group operator_group_light">(</button>
					<button type="button" id="right_parenthesis" class="operate_group operator_group_light">)</button>
					<button type="button" id="square_root" class="operate_group operator_group_light">√</button>
					<button type="button" id="square" class="operate_group operator_group_light">x²</button>
				</div>
				<div class="div_flex div_justify_content div_row">
					<button type="button" id="clear" class="clear_light">C</button>
					<button type="button" id="backspace" class="backspace_light">⌫</button>
					<button type="button" id="ans" class="operand_group operand_group_light">Ans</button>
					<button type="button" id="divide" class="operate_group operator_group_light">÷</button>
				</div>
				<div class="div_flex div_justify_content div_row">
					<button type="button" id="seven" class="operand_group operand_group_light">7</button>
					<button type="button" id="eight" class="operand_group operand_group_light">8</button>
					<button type="button" id="nine" class="operand_group operand_group_light">9</button>
					<button type="button" id="multiply" class="operate_group operator_group_light">×</button>
				</div>
				<div class="div_flex div_justify_content div_row">
                    <button type="button" id="four" class="operand_group operand_group_light">4</button>
					<button type="button" id="five" class="operand_group operand_group_light">5</button>
					<button type="button" id="six" class="operand_group operand_group_light">6</button>
					<button type="button" id="subtract" class="operate_group operator_group_light">-</button>					
				</div>
				<div class="div_flex div_justify_content div_row">
					<button type="button" id="one" class="operand_group operand_group_light">1</button>
					<button type="button" id="two" class="operand_group operand_group_light">2</button>
					<button type="button" id="three" class="operand_group operand_group_light">3</button>
					<button type="button" id="add" class="operate_group operator_group_light">+</button>	
				</div>
				<div class="div_flex div_justify_content div_row">
					<button type="button" id="percentage" class="operand_group operand_group_light">%</button>
					<button type="button" id="zero" class="operand_group operand_group_light">0</button>
					<button type="button" id="decimal" class="operand_group operand_group_light">.</button>
					<button type="button" id="equal" class="equal_light">=</button>
				</div>
			</div>
		</div>
		<script type="text/javascript" src="js/jquery-3.2.1.min.js"></script>
		<script type="text/javascript" src="js/math.min.js"></script>
		<script type="text/javascript" src="js/common.js"></script>
	</body>
</html>

只给出了前端界面部分,需参考可到下载地址下载全部代码。


猜你喜欢

转载自blog.csdn.net/qq_31674229/article/details/79499687