结果总是不对,,麻烦帮忙看下,谢谢。
来源:5-10 编程练习
fanfan_18_tang
2017-11-08 11:10:15
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>员工合同到期时间</title>
</head>
<body>
<script>
//代码补充
var a=prompt("请输入员工的入职年份");
var b=prompt("请输入员工的入职月份");
var c=prompt("请输入员工的入职时间");
function startime(a,b,c){
var temp=new Date(a,b,c)
var newyear=temp.getFullYear(a)+3;
var newmonth=b;
var newdater=c;
return newyear+"-"+(newmonth)+"-"+newdater+"<br/>";
}
document.write("该员工入职时间是:"+a+"-"+b+"-"+c+"<br/>");
var time=startime(a,b,c);
document.write("该员工合同到期时间是:"+time);
</script>
</body>
</html>
1回答
我们先要设置3年后的时间,然后通过对应的方法分别获取年月日
相似问题