<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script type="text/javascript">
function getdate()
{
var stdate=document.getElementById("stdate").value+"";

var sumdate=document.getElementById("sumdate").value;
var eddate=document.getElementById("eddate");
var a = new Date(stdate)
a = a.valueOf()
a = a +sumdate * 24 * 60 * 60 * 1000
a = new Date(a)
eddate.innerHTML=a.getFullYear() + "年" + (a.getMonth() + 1) + "月" + a.getDate() + "日";
}

</script>
</head>

<body>
(提示:日期格式为:2011/8/22)<br />
开始日期:<input type="text"  id="stdate"  value="" />+<input type="text"  id="sumdate"  value="45" />天数=<span id="eddate"></span>
<input type="button"  id="stdate" value="计算" onclick="getdate()" />
</body>
</html>

posted on 2011-08-22 17:19  超级大白  阅读(1489)  评论(0编辑  收藏  举报