I like this script
one click at a time....only one page at a time in order is what I would like it to do
Not random......
can anyone help me or is there a script i haven't found that does the same..???
Thanx so much for help.....

CODE:
<script>
<!--
/*
Random link button- By JavaScript Kit (http://javascriptkit.com)
Over 300+ free scripts!
This credit MUST stay intact for use
*/

//specify random links below. You can have as many as you want
var randomlinks=new Array()

randomlinks[0]="http://mysite/page/file"
randomlinks[1]="http://mysite/page/file"
randomlinks[2]="http://mysite/page/file"
randomlinks[3]="http://mysite/page/file"
randomlinks[4]="http://mysite/page/file"

function randomlink(){
window.location=randomlinks[Math.floor(Math.random()*randomlinks.length)]
}
//-->
</script>
<form>
<p><input type="button" name="B1" value="Random Link >>" onclick="randomlink()"></p> </form>

<!--Uncomment below to use a regular text link instead
<a href="javascript:randomlink()">Random Link</a>
-->

Try this:

<script>
<!--
var counter=0;
//specify random links below. You can have as many as you want
var randomlinks=new Array()

randomlinks[0]="http://mysite/page/file"
randomlinks[1]="http://mysite/page/file"
randomlinks[2]="http://mysite/page/file"
randomlinks[3]="http://mysite/page/file"
randomlinks[4]="http://mysite/page/file"

function randomlink(){
window.location=randomlinks[counter];
counter = (++counter)%randomlinks.length;
}
//-->
</script>

thanx for the reply hielo...
I tried it out but it does not go to another link...
clicks only one..well the homepage...only...
any idea ???

> window.location=randomlinks[counter]; This is incorrect since location is an object or a property of the window object and you are assigning a string to it. The correct way of doing it is location.href = randomlinks[counter]; ( window object is implied)

> counter = (++counter)%randomlinks.length; Don't see this would serve any purpose once the user has navigated away from the page after changing the href ...

I have this script in a header which may make a difference.... the button always shows up unless I go to an outside link...not sure but below it is....

This only executes the link the "var counter" is set to... like "3" or "5" or "0"
Can anyone see anything wrong with this ???
I cann't seem to get it to go to the next number when it is clicked again...
============================================================================
<script>
<!--
var counter=3;
//specify random links below. You can have as many as you want
var randomlinks=new Array()

randomlinks[0]="http://www.mysiteone
randomlinks[2]="http://www.mysitetwo
randomlinks[3]="http://www.mysitethree
randomlinks[4]="http://www.mysitefour
randomlinks[5]="http://www.mysitefive

function randomlink(){
location.href = randomlinks[counter];

}
//-->
</script>
=======================
please help me if you can...
thanx

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.