So I added the code below to my website so when a user clicks the button a random website opens. Well after I added more links to it it only would open the first 5 links I entered out of 20. How to I edit the code to open one of all 20 links?
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->
<!-- Begin
function go_to(url) {
window.location=url;
}
function rand_link() {
var a;
a = 1+Math.round(Math.random()*3); // a = random number between 1-3
if (a==1) go_to("http://bgeffects.javascriptsource.com");
if (a==2) go_to("http://clocks.javascriptsource.com");
if (a==3) go_to("http://games.javascriptsource.com");
}
// End -->
</SCRIPT>
<BODY>
<CENTER>
<FORM NAME="myForm">
<INPUT TYPE="button" NAME="myButton" VALUE="Random link"
onClick="rand_link()">
</FORM>
</CENTER>
<p><center>
<font face="arial, helvetica" size="-2">Free JavaScripts provided<br>
by <a href="http://javascriptsource.com">The JavaScript Source</a></font>
</center><p>
<!-- Script Size: 1.00 KB -->
Then I edited the code by adding 12 more links following the same code pattern and also changing
a = 1+Math.round(Math.random()*3); // a = random number between 1-3 To
a = 1+Math.round(Math.random()*20); // a = random number between 1-20
My website is http://www.webroulette.us.tc/ if you want to try it for yourself
P.S sorry I couldn't add the entire code after I edited it I guess there is a new policy on here you cant have more than 10 links
If you need any more info please let me know.
Ive tried using Google chrome and Internet explorer and got the same result
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->
<!-- Begin
function go_to(url) {
window.location=url;
}
function rand_link() {
var a;
a = 1+Math.round(Math.random()*3); // a = random number between 1-3
if (a==1) go_to("http://bgeffects.javascriptsource.com");
if (a==2) go_to("http://clocks.javascriptsource.com");
if (a==3) go_to("http://games.javascriptsource.com");
}
// End -->
</SCRIPT>
<BODY>
<CENTER>
<FORM NAME="myForm">
<INPUT TYPE="button" NAME="myButton" VALUE="Random link"
onClick="rand_link()">
</FORM>
</CENTER>
<p><center>
<font face="arial, helvetica" size="-2">Free JavaScripts provided<br>
by <a href="http://javascriptsource.com">The JavaScript Source</a></font>
</center><p>
<!-- Script Size: 1.00 KB -->
Then I edited the code by adding 12 more links following the same code pattern and also changing
a = 1+Math.round(Math.random()*3); // a = random number between 1-3 To
a = 1+Math.round(Math.random()*20); // a = random number between 1-20
My website is http://www.webroulette.us.tc/ if you want to try it for yourself
P.S sorry I couldn't add the entire code after I edited it I guess there is a new policy on here you cant have more than 10 links
If you need any more info please let me know.
Ive tried using Google chrome and Internet explorer and got the same result