【发布时间】:2018-02-03 16:16:41
【问题描述】:
这是我尝试使用并嵌入到 Google 协作平台页面中的代码:
<!DOCTYPE html>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Please follow the link below</title>
<script>
var urls = [
"http://www.kittenwar.com/",
'http://heeeeeeeey.com/',
'http://eelslap.com/',
'http://www.staggeringbeauty.com/',
'http://www.omfgdogs.com/',
'http://burymewithmymoney.com/',
'http://www.fallingfalling.com/',
'http://ducksarethebest.com/',
'http://www.republiquedesmangues.fr/',
'http://www.trypap.com/',
];
function goSomewhere() {
var url = urls[Math.floor(Math.random()*urls.length)];
window.location = url; // redirect
}
</script>
</head>
<body>
</body>
</html>
如何进行这项工作,以便在我的 Google 协作平台页面中出现一个按钮,该按钮会随机将您分配到列出的链接数组之一?
【问题讨论】:
标签: javascript html redirect random url-redirection