var all_daihao = [
'https://baidu1.com',
'https://baidu2.com',
'https://baidu3.com',
'https://baidu4.com'
];
alert(all_daihao[Math.floor(Math.random()*all_daihao.length)]);
// window.location.href = all_daihao[Math.floor(Math.random()*all_daihao.length)];
js 随机跳转
最新推荐文章于 2024-07-23 03:49:21 发布
本文介绍了一个简单的JavaScript脚本,该脚本可以从预定义的URL数组中随机选择一个URL进行访问。通过使用Math.random()函数结合数组长度,可以实现对数组元素的随机访问。
744

被折叠的 条评论
为什么被折叠?



