<META HTTP-EQUIV="refresh" CONTENT="10; URL=http://xxx.xxx.xxx.xxx">
可以 10 秒導向另一個網址
如果要在網頁上秀出 10 9 8 7 6 5 4 3 2 1 的倒數語法,要如何製作
謝謝 ^_^
<META HTTP-EQUIV="refresh" CONTENT="10; URL=http://xxx.xxx.xxx.xxx">
可以 10 秒導向另一個網址
如果要在網頁上秀出 10 9 8 7 6 5 4 3 2 1 的倒數語法,要如何製作
謝謝 ^_^
請混合使用 javascript 與 HTML DOM.
動態式client side = javascript + HTML DOM
動態式server side = PHP, etc
<html>
<head>
<script type="text/javascript">
var t
function timedCount(){
document.getElementById('txt').value -= 1
if( document.getElementById('txt').value > 0)
t=setTimeout("timedCount()",1000)
if( document.getElementById('txt').value == 0)
window.open('你的url','_self');
}
</script>
</head>
<body onload="timedCount()">
<input type="text" id="txt" value="11">
</body>
</html>
此文章於 2006-06-03 02:15 PM 被 twpollo 編輯。
只要copy這個到 .html 就可以了
PS: 這是剛剛一點空閒的時候寫的~
所以有些可縮短和改進的地方~
但重點是 100%可用 ... ( ^_^) /
補充:
要 20sec的話就把
<input type="text" id="txt" value="11">
改為
<input type="text" id="txt" value="21">
還有要導向另一個網址如 http://xxx.xxx.xxx.xx/就是把
window.open('你的url','_self');
改成
window.open('http://xxx.xxx.xxx.xx/','_self');
就這樣 ^^
謝謝您,可以 ^_^
書籤