avalonx
03-01-2003, 01:04 AM
I really like the "Super Random Link Generator" from javascriptkit.com, because you don't need an array of links, which is annoying if you have 300 links on a page, changing frequently.
<script>
<!--
/*Super random link script- Written by JavaScript Kit
(www.javascriptkit.com) over 200+ free JavaScripts here!
*/
function random_all(){
var myrandom=Math.round(Math.random()*(document.links.length-1))
window.location=document.links[myrandom].href
}
//-->
</script>
I'd like to modify this script so that only links with the ending *.php are chosen. How could this be done?
<script>
<!--
/*Super random link script- Written by JavaScript Kit
(www.javascriptkit.com) over 200+ free JavaScripts here!
*/
function random_all(){
var myrandom=Math.round(Math.random()*(document.links.length-1))
window.location=document.links[myrandom].href
}
//-->
</script>
I'd like to modify this script so that only links with the ending *.php are chosen. How could this be done?