『壹』 隨機網頁跳轉代碼怎麼寫
Copyright © 1999-2020, CSDN.NET, All Rights Reserved
登錄
李姝愛
關注
html自動隨機跳轉網址,網頁隨機跳轉代碼 轉載
2021-06-02 15:26:24
李姝愛
碼齡4年
關注
網頁隨機跳轉代碼
zkx • 2021 年 05 月 31 日
Loading...
```shell
網頁隨機跳轉
var theAds = new Array(
"http://a.com",
"http://a.com",
"http://a.com",
"http://a.com",
"http://a.com"
);
shu = theAds.length ;
sx = parseInt(Math.random() * shu );
var tanurl = theAds[sx] ;
top.location.href = tanurl;
```
```shell
function dogo(){
var urls = new Array();
urls[0]="site1";
urls[1]="site2";
urls[2]="site3";
urls[3]="site4";
urls[4]="site5";
n = Math.floor(Math.random()* 5);
location.href= urls[n];
}
『貳』 html或者ASP隨機跳轉代碼
<html>
<head>
<title>blog</title>
<SCRIPT LANGUAGE="JavaScript">
function a(){
setTimeout("b()",1000);//點擊按鈕一秒鍾後跳轉到隨機頁面
}
function b(){//跳轉函數
var randompath=parseInt(Math.random()*3)+1;//隨機得到1到3的整數(1,2,3)
window.location=randompath+".html";
}
</SCRIPT>
</head>
<body onload="a()">
<input onclick="a()" type="button" value="隨機跳轉">
</body>
</html>
『叄』 js自動跳轉代碼
隨機跳轉到特定網址段的其中一個頁面???可以跳轉到指定的頁面,你要想隨機跳轉,你就應該要知道這個網址段的頁面具體路徑,並把這些路徑存儲在一個數組中,然後隨機取出,用setTimeout定時,跳轉就OK了!
『肆』 網頁定時自動跳轉到隨機頁面JS代碼
定時用 setTimeout函數
<script>
var numb;
function brand(a)
{
return parseInt((a)*Math.random()+1);
}
function goUrl(){
numb=brand(5);
window.location = "http://www.hao123.com/"+numb+".html";
}
setTimeout(goUrl,500)//500是0.5秒
</script>
『伍』 怎樣製作一個可以自動跳轉至另一個網頁的網頁 要編程
加上下面這段代碼就行了,特簡單:
<a href="這里是網址" target="_blank">點擊這里的文字可以打開鏈接</a>
只要把這句代碼加在網頁里就可以了。