我有以下代码,我想使用一个大的中心对齐按钮将访问者的网站随机重定向到一个网址之一:
<html>
<head>
<script type="text/javascript">
<!--
// Create an array of the links to choose from:
var links = new Array();
links[0] = "http://www.google.com/";
links[1] = "http://www.bing.com/";
links[2] = "http://www.yahoo.com/";
links[3] = "http://www.apple.com/";
function openLink() {
// Chooses a random link:
var i = Math.floor(Math.random() * links.length);
// Directs the browser to the chosen target:
parent.location = links[i];
return false;
}
//-->
</script>
</head>
<body onload="openLink();">
</body>
</html>
我应该如何调整上述代码来实现这一目标?谢谢你的帮助。
答案 0 :(得分:0)
试试这个
mysql -p mysql
答案 1 :(得分:0)
尝试使用此代码
<html>
<head>
<script type="text/javascript">
<!--
// Create an array of the links to choose from:
var links = new Array();
links[0] = "http://www.google.com/";
links[1] = "http://www.bing.com/";
links[2] = "http://www.yahoo.com/";
links[3] = "http://www.apple.com/";
function openLink() {
// Chooses a random link:
var i = Math.floor(Math.random() * links.length);
// Directs the browser to the chosen target:
parent.location = links[i];
return false;
}
//-->
</script>
<style>
.btn {
height:50px;
width:200px;
background:#125288;
color:#fff;
font-size:18px;
}
</style>
</head>
<body>
</body>
<center>
<button onclick="openLink();" class='btn'>Try to Click</button>
</center>
</html>