<div id="pad"></div>
<button id="btn" style="display:none;">xxx</button><script>
var n = 10
var tid = setTimeout("show()", 100);function show(){
if(tid != null) {clearTimeout(tid);tid = null;}
if(n==0) document.getElementById("btn").style.display = "block";
else{n--;document.getElementById("pad").innerText = n;tid = setTimeout("show()", 100);}
}
</script>
<button id="btn" style="display:none;">xxx</button><script>
var n = 10
var tid = setTimeout("show()", 100);function show(){
if(tid != null) {clearTimeout(tid);tid = null;}
if(n==0) document.getElementById("btn").style.display = "block";
else{n--;document.getElementById("pad").innerText = n;tid = setTimeout("show()", 100);}
}
</script>
<script>
var i=60;
function $(Id){return document.getElementById(Id)}
function create(elm,parent,fn){
var obj = document.createElement(elm)
if(fn)fn(obj)
parent.appendChild(obj)
}
create('div',document.body,function(obj){obj.id='show';})
var timer = setInterval(function(){
if(i==0){clearTimeout(timer);create("input",document.body,function(obj){obj.type="button";obj.value='hi!!'})}
$('show').innerHTML=i;
i--;
},1000)
</script>
(按钮:type=submit)
<script>
var i=60*15;
function $(Id){return document.getElementById(Id)}
function create(elm,parent,fn){
var obj = document.createElement(elm)
if(fn)fn(obj)
parent.appendChild(obj)
}
create('div',document.body,function(obj){obj.id='show';})
var timer =setInterval(function(){
var rs=/time=\w+/.exec(document.cookie);
if(rs==null)
{
document.cookie="time="+i;
$('show').innerHTML=i;
}
else
{
var num = parseInt(/\d+/.exec(rs.toString()));
if(num!=0)
{
num--;
$('show').innerHTML=num;
document.cookie="time="+num
}
else
{
clearTimeout(timer);
var d = new Date(2000,1,1);
document.cookie ="time=;expires= " + d.toGMTString() //清除cookie
create("input",document.body,function(obj){obj.type="submit";obj.value='hi!!'})
//alert(document.cookie)
}
}
},1)//改成1000
</script>