samedi 27 juillet 2019

Is there a way to pop link sequentially on click?

I am trying to create a button that will bring users to specific link. For example, I have 5 links, is there a way I can specify that upon each click it will bring user to the saved links sequentially?

On my code below, I have a random link function, that says, upon each click, user will be directed to one of the links randomly.

Is there a way, say, first user who clicks will be directed to link 1, and second user to Link 2, and etc.?

*/


var randomlinks=new Array()

randomlinks[0]="www.Link 1.com"
randomlinks[1]="www.Link 2.com"
randomlinks[2]="www.Link 3.com"
randomlinks[3]="www.Link 4.com"
randomlinks[4]="www.Link 5.com"

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




Aucun commentaire:

Enregistrer un commentaire