简单的计算器源码
如图:
网页计算器html代码代码
<DOCTYPE html>
<html>
<meta name="content-type" content="text/html; charset=UTF-8">
<head>
<style type="text/css"><—这个是css样式-->
{ font-size:16px; background-color: FF0;
width:38px; height:28px;
border-bottom-left-radius:7px; border-bottom-right-radius:7px; border-top-left-radius:7px; border-top-right-radius:7px
}
</style>
<script><—这个是js函数-->
var numresult;
var str;
function onclicknum nums {
str = "MyText";
= + nums;
}
function onclickclear {
str = "MyText";
= "";
}
function onclickresult {
str = "MyText";
numresult = eval;
= numresult;
}
</script>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>我的计算器</title>
</head>
<div >
<input type="text" id="MyText" /><br />
<br />
<input class="MyButton" type="button" value="1" id="1" onclick="onclicknum1"/> <input class="MyButton" type="button" Id="2" value="2" onclick="onclicknum2" /> <input class="MyButton" type="button" value="3" onclick="onclicknum3 "/>
<input class="MyButton" type="button" name="jian" value="-"
onclick="onclicknum'-'" /><br />
<input class="MyButton" type="button" name="four" value="4"
onclick="onclicknum4" />
<input class="MyButton" type="button" name="five"
value="5"onclick="onclicknum5" />
<input class="MyButton" type="button" name="six"
value="6"onclick="onclicknum6" />
<input class="MyButton" type="button" name="chen" value="" onclick="onclicknum''" /><br />
<input class="MyButton" type="button" name="seveen" value="7" onclick="onclicknum7" />
<input class="MyButton" type="button" name="eghit" value="8" onclick="onclicknum8" />
<input class="MyButton" type="button" name="nine" value="9" onclick="onclicknum9" />
<input class="MyButton" type="button" name="chu" value="/" onclick="onclicknum'/'" /><br />
<input class="MyButton" type="button" name="zero"
value="0"onclick="onclicknum0" />
<input class="MyButton" type="button" name="qin" value="del" onclick="onclickclear" />
<input class="MyButton" type="button" name="all" value="=" onclick="onclickresult " />
<input class="MyButton" type="button" name="jia" value="+" onclick="onclicknum'+'" />
</div>
<body>
</body>
</html>
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论