Greetings. How to do it opening a random link from many?
Example:
<html>
<head>
<script type="text/javascript">
<!--
// Create an array of the links to choose from:
var links = new Array();
links[0] = "http://www.link1.com/";
links[1] = "http://www.link2.com/";
links[2] = "http://www.link3.com/";
links[3] = "http://www.link4.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;
return false;
}
//-->
</script>
</head>
<body>
</html>
I want to open one of the integrated links on every reload.
Example:
<html>
<head>
<script type="text/javascript">
<!--
// Create an array of the links to choose from:
var links = new Array();
links[0] = "http://www.link1.com/";
links[1] = "http://www.link2.com/";
links[2] = "http://www.link3.com/";
links[3] = "http://www.link4.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;
return false;
}
//-->
</script>
</head>
<body>
</html>
I want to open one of the integrated links on every reload.
Последно редактирано от модератор: