我正在爲我的網站使用JavaScript「倒計時然後重定向」腳本。我想使用類似HTTP引用在下面的腳本附:如何有條件地將引用鏈接重定向到不同的網頁?
<script>
<!--
/*
Count down then redirect script
By JavaScript Kit (http://javascriptkit.com)
*/
//change below target URL to your own
var targetURL="www.domain.com";
//change the second to start counting down from
var countdownfrom=20;
var currentsecond = document.redirect.redirect2.value =
countdownfrom + 1;
function countredirect() {
if (currentsecond != 1) {
currentsecond -= 1;
document.redirect.redirect2.value = currentsecond
} else {
window.location = targetURL;
return;
}
setTimeout(countredirect, 1000);
}
countredirect();
//-->
</script>
我希望腳本一樣工作:
如果有人從www.twitter.com到達時,它們將被重定向到www .domain.com/twitter.html倒數後。
如果有人從www.facebook.com抵達,他們將在倒計時後重定向到www.domain.com/facebook.html。
如果有人從www.youtube.com抵達,他們將在倒計時後重定向到www.domain.com/youtube.html。
我想重定向15-20 URL。請幫忙 !!我該怎麼做 ??
我已經刪除了自己[標籤:JAVA]標籤爲你的問題似乎已經無關,與使用這種語言。 – 2015-02-24 19:18:38