dimanche 10 décembre 2017

Is it possible to limit a random link script ( Random_All ) to a certain area?

I'm having trouble limiting the random_all script to just a certain area. I tried to do this by hiding the div containers on my page, but that didn't hide the links from the script itself.

Does anyone know how to modify the document.links.length-1 or the window.location to just perform the random link generator in just the the or a specified section of my page?

Here's the page i'm working with: http://ift.tt/2AsHZ8I

Thanks for your help.

<script>

function random_all(){
var myrandom=Math.round(Math.random()*(document.links.length-1))
window.location=document.links[myrandom].href
} 
//-->
</script>

<center><h3>#<a href="javascript:random_all()">RANDOM</a></h3>
</center>




Aucun commentaire:

Enregistrer un commentaire