请教一个js计算时间的思路问题? 我想实现一个由用户输入时间,比如说是(2012-04-11 15:20:15)然后就在页面的右上角对这个时间动态累加,比如说5秒后就显示(2012-04-11 15:20:20),这个该怎么实现呢?请前辈们提供下思路,谢谢!或者有类似的js时间插件可以,谢谢大家了~~~ 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <!doctype html><html> <head> <title>tank fighting</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> </head> <body> <div id="showDIV"></div> <input id="inputbox" type="text" value="" /> <input id="startBtn" type="button" value="Start" /> <input id="stopBtn" type="button" value="Stop" /> <script> var timer; document.getElementById('startBtn').onclick = function(){ var inputbox = document.getElementById('inputbox'), baseTime = new Date(inputbox.value).getTime(), orginal = new Date().getTime(), time, showTime, div = document.getElementById('showDIV'); timer = setInterval(function(){ time = new Date().getTime(); showTime = new Date(time - orginal + baseTime); div.innerHTML = showTime; }, 1000); }; document.getElementById('stopBtn').onclick = function(){ clearInterval(timer); }; </script> </body> </html> html:select的横scrollbar如何表示 如何用js获取来源url地址 用JS如何连接ACCESS 再线等~~~~~~~~~~~ focus and select and chaneg the backgroud color 发一个用JavaScript得到绝对路径的方法 form.all.xxx.value其中all的含义 给资料了! 在easyui datagrid某一列增加倒计时 移动端 购物车缩小-变大-还原的效果怎么做? 前端小白。 谁会用JS做一个动态效果的图片啊 语句解释
<html>
<head>
<title>tank fighting</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<div id="showDIV"></div>
<input id="inputbox" type="text" value="" />
<input id="startBtn" type="button" value="Start" />
<input id="stopBtn" type="button" value="Stop" />
<script>
var timer;
document.getElementById('startBtn').onclick = function(){
var inputbox = document.getElementById('inputbox'),
baseTime = new Date(inputbox.value).getTime(),
orginal = new Date().getTime(),
time,
showTime,
div = document.getElementById('showDIV');
timer = setInterval(function(){
time = new Date().getTime();
showTime = new Date(time - orginal + baseTime);
div.innerHTML = showTime;
}, 1000);
};
document.getElementById('stopBtn').onclick = function(){
clearInterval(timer);
};
</script>
</body>
</html>