‘壹’ 随机网页跳转代码怎么写
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>
只要把这句代码加在网页里就可以了。