HTML⽹页之计算器代码
计算器⽹页效果显⽰:
<script>
function show(){
var date = new Date(); //⽇期对象
var now = "";
now = FullYear()+"年"; //读英⽂即可了
now = now + (Month()+1)+"⽉"; //取⽉的时候取的是当前⽉-1假设想取当前⽉+1就能够了swiper轮播
now = now + Date()+"⽇";
now = now + Hours()+"时";
now = now + Minutes()+"分";
now = now + Seconds()+"秒";
setTimeout("show()",1000); //设置过1000毫秒就是1秒,调⽤show⽅法
}
</script>
<!DOCTYPE html>
<html>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<head>
<title>Calculator</title>
<!--将按键内容以字符串形式存储在⽂字框中当button为“=”时。调⽤eval⽅法计算结果然后将结果输出⽂字框中--> <script type="text/javascript">
var numresult;
var str;
function onclicknum(nums) {html个人网页完整代码怎么看
str = ElementById("nummessege");
str.value = str.value + nums;
}
function onclickclear() {
str = ElementById("nummessege");
str.value = "";
}
function onclickresult() {
str = ElementById("nummessege");
numresult = eval(str.value);
str.value = numresult;
}
</script>
<style type="text/css">
img{
position:absolute;
left:1100px;
top:100px;
}
</style>
</head>
<body>  <!⽤来显⽰时间>
<h2 align=right><font color="#cc0033">
<body onload="show()">  <!-- ⽹页载⼊时调⽤⼀次以后就⾃⼰主动调⽤了-->
<div id="nowDiv"></div>
</font></h2>
</body>
<body bgcolor="#9900ff" >
<a  href="../index.html"><img border="0" src="./image/4.jpg" alt="主页⾯" title="返回主页⾯"></a>
<font color="red" size="6"><center>⽹络⼈VS灰鸽⼦⼯作室</center></font>
<p></p>
<!--定义按键表格,每⼀个按键相应⼀个事件触发-->
<table border="1" align="center" bgColor="#6633CC"
>
<tr>
<td colspan="4">
<input type="text" id="nummessege"
/>
</td>
</tr>
<tr>
<td>
<input type="button" value="1" id="1" onclick="onclicknum(1)"
>
</td>
<td>
<input type="button" value="2" id="2" onclick="onclicknum(2)"
>
</td>
<td>
<input type="button" value="3" id="3" onclick="onclicknum(3)"
>
</td>
<td>
<input type="button" value="+" id="add" onclick="onclicknum('+')"
>
</td>
</tr>
<tr>
<td>
<input type="button" value="4" id="4" onclick="onclicknum(4)"
>
</td>
<td>
<input type="button" value="5" id="5" onclick="onclicknum(5)"
>
</td>
<td>
<input type="button" value="6" id="6" onclick="onclicknum(6)"
>
</td>
<td>
<input type="button" value="-" id="sub" onclick="onclicknum('-')"
>
</td>
</tr>
<tr>
<td>
<input type="button" value="7" id="7" onclick="onclicknum(7)"
>
</td>
<td>
<input type="button" value="8" id="8" onclick="onclicknum(8)"
>
</td>
<td>
<input type="button" value="9" id="9" onclick="onclicknum(9)"
>
</td>
<td>angular合并不同分组
<input type="button" value="*" id="mul" onclick="onclicknum('*')"
>
</td>
</tr>
<tr>
<td colspan="2">
易语言教程百度经验
<input type="button" value="0" id="0" onclick="onclicknum(0)"
>
</td>
<td>
<input type="button" value="." id="point" onclick="onclicknum('.')"linux运行windows软件
>
</td>
<td>
<input type="button" value="/" id="division"
onclick="onclicknum('/')"
>
</td>
</tr>
<tr>
<td colspan="2">
编码表
<input type="button" value="Del" id="clear"
onclick="onclickclear()"
/>
</td>
<td colspan="2">
<input type="button" value="=" id="result"
onclick="onclickresult()"
/>
</td>
</tr>
</table>
<font size="5" color="ff99ff">Design by:<a target="_blank" href="blog.csdn/qq_21792169/article/details/50629515" >⽹络⼈VS灰鸽⼦</a> 2016-
3-
3                         &邮箱:linux_drv@yeah</font>
<! 这⾥为了⽅便我就直接加⼊空格来布局了,这⾥能够使⽤style>
</body>
</html>

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。