js 效果显示不粗来 浏览器也找不到错误什么原因 请大神指点
<style>.t1{width:400px;}</style><scripttype="text/javascript">window.onload=function(...
<style>
.t1 { width:400px;}
</style>
<script type="text/javascript">
window.onload = function () {
var aInp= document.getElementsByTagName('input');
var iNow=null;
var iNew=null;
var t =0 ;
var str='';
var timer=null;
aInp[2].onclick= function () {
iNew= new Date(aInp[0].value);
clearInterval(timer);
timer= setInterval (function () {
iNow= new Date();
t = Math.floor((iNew-iNow)/1000);
if (t>=0) {
str = Math.floor(t/86400)+'天'+ Math.floor(t%86400/3600)+'时'+ Math.floor(t%86400/3600/60)+'分'+ t%60+'秒'
aInp[1].value= str;
} else {
clearInterval(timer);
}
},1000)
};
};
</script>
</head>
<body>
距离<input class="t1" type="text" value="Novermber 28,2017 22:39:00"/><br/>
还剩<input class="t1" type="text"/>
<input name="button" type="button" value="倒计时"/>
</body>
</html> 展开
.t1 { width:400px;}
</style>
<script type="text/javascript">
window.onload = function () {
var aInp= document.getElementsByTagName('input');
var iNow=null;
var iNew=null;
var t =0 ;
var str='';
var timer=null;
aInp[2].onclick= function () {
iNew= new Date(aInp[0].value);
clearInterval(timer);
timer= setInterval (function () {
iNow= new Date();
t = Math.floor((iNew-iNow)/1000);
if (t>=0) {
str = Math.floor(t/86400)+'天'+ Math.floor(t%86400/3600)+'时'+ Math.floor(t%86400/3600/60)+'分'+ t%60+'秒'
aInp[1].value= str;
} else {
clearInterval(timer);
}
},1000)
};
};
</script>
</head>
<body>
距离<input class="t1" type="text" value="Novermber 28,2017 22:39:00"/><br/>
还剩<input class="t1" type="text"/>
<input name="button" type="button" value="倒计时"/>
</body>
</html> 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询