2013年07月25日
阿新 • • 發佈:2019-01-28
<div
id='date'></div>
<form method="post" action="">
<input type='button' disabled value='秒殺' id='img'>
</form>
<script language="javascript">
//秒殺開始前到伺服器當前的秒數
var time_qian = 10;
//秒殺結束時間的時間戳減去秒殺開始的秒數
var time_jian = 10;
//秒殺前提醒
function date(){
var h = Math.floor(time_qian/3600);
var f = time_qian600;
var fen = Math.floor(f/60);
var m = f`
time_qian--;
document.getElementByIdx_x('date').innerHTML='距秒殺開始還有'+h+'小時'+fen+'分鐘'+m+'秒';
if(time_qian==0){
clearInterval(miao_qian);
miao_kai = setInterval('date1()',1000);
document.getElementByIdx_x('date').innerHTML='秒殺開始';
document.getElementByIdx_x('img').removeAttribute('disabled');
}
}
//開始秒殺
function date1(){
var h = Math.floor(time_jian/3600);
var f = time_jian600;
var fen = Math.floor(f/60);
var m = f`
time_jian--;
document.getElementByIdx_x('date').innerHTML='距秒殺結束還有'+h+'小時'+fen+'分鐘'+m+'秒';
if(time_jian==0){
document.getElementByIdx_x('date').innerHTML='秒殺結束';
clearInterval(miao_kai);
}
}
//秒殺前倒計時
miao_qian = setInterval('date()',1000);
</script>
<form method="post" action="">
<input type='button' disabled value='秒殺' id='img'>
</form>
<script language="javascript">
//秒殺開始前到伺服器當前的秒數
var time_qian = 10;
//秒殺結束時間的時間戳減去秒殺開始的秒數
var time_jian = 10;
//秒殺前提醒
function date(){
var h = Math.floor(time_qian/3600);
var f = time_qian600;
var fen = Math.floor(f/60);
var m = f`
time_qian--;
document.getElementByIdx_x('date').innerHTML='距秒殺開始還有'+h+'小時'+fen+'分鐘'+m+'秒';
if(time_qian==0){
clearInterval(miao_qian);
miao_kai = setInterval('date1()',1000);
document.getElementByIdx_x('date').innerHTML='秒殺開始';
document.getElementByIdx_x('img').removeAttribute('disabled');
}
}
//開始秒殺
function date1(){
var h = Math.floor(time_jian/3600);
var f = time_jian600;
var fen = Math.floor(f/60);
var m = f`
time_jian--;
document.getElementByIdx_x('date').innerHTML='距秒殺結束還有'+h+'小時'+fen+'分鐘'+m+'秒';
if(time_jian==0){
document.getElementByIdx_x('date').innerHTML='秒殺結束';
clearInterval(miao_kai);
}
}
//秒殺前倒計時
miao_qian = setInterval('date()',1000);
</script>