PCZONE 討論區

PCZONE 討論區 (https://www.pczone.com.tw/vbb3/)
-   -- 網 路 技 術 版 (https://www.pczone.com.tw/vbb3/forum/29/)
-   -   【問題】倒數 10 秒 語法 (https://www.pczone.com.tw/vbb3/thread/29/124390/)

bloom 2006-05-30 03:22 PM

【問題】倒數 10 秒 語法
 
<META HTTP-EQUIV="refresh" CONTENT="10; URL=http://xxx.xxx.xxx.xxx">
可以 10 秒導向另一個網址

如果要在網頁上秀出 10 9 8 7 6 5 4 3 2 1 的倒數語法,要如何製作
謝謝 ^_^

twpollo 2006-06-02 02:06 PM

回覆: 【問題】倒數 10 秒 語法
 
請混合使用 javascript 與 HTML DOM.

動態式client side = javascript + HTML DOM
動態式server side = PHP, etc

twpollo 2006-06-03 12:53 PM

回覆: 【問題】倒數 10 秒 語法
 
<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>

twpollo 2006-06-03 02:15 PM

回覆: 【問題】倒數 10 秒 語法
 
只要copy這個到 .html 就可以了
PS: 這是剛剛一點空閒的時候寫的~
所以有些可縮短和改進的地方~
但重點是 100%可用 ... ( ^_^) /

twpollo 2006-06-03 02:20 PM

回覆: 【問題】倒數 10 秒 語法
 
補充:
要 20sec的話就把
<input type="text" id="txt" value="11">
改為
<input type="text" id="txt" value="21">
還有要導向另一個網址如 [url]http://xxx.xxx.xxx.xx/就是把[/url]
window.open('你的url','_self');
改成
window.open('http://xxx.xxx.xxx.xx/','_self');

就這樣 ^^

bloom 2006-06-05 03:54 PM

回覆: 【問題】倒數 10 秒 語法
 
謝謝您,可以 ^_^


所有時間均為 +8。現在的時間是 03:04 AM



 XML   RSS 2.0   RSS 
本站使用 vBulletin 合法版權程式
站務信箱 : [email protected]

本論壇所有文章僅代表留言者個人意見,並不代表本站之立場,討論區以「即時留言」方式運作,故無法完全監察所有即時留言,若您發現文章可能有異議,請 email :[email protected] 處理。