I have a navigation bar and I want to access a random URL from a distinct list associated with each link. Link A would access List A, link B would access List B, and so on. I have been using a javascript code from 1997 that works great for one link:
载于js文档中的“设计”;
rnd.today=new Date();
rnd.seed=rnd.today.getTime();
function rnd() {
rnd.seed = (rnd.seed*9301+49297) % 233280;
return rnd.seed/(233280.0);
};
function rand(number) {
return Math.ceil(rnd()*number);
};
var item = 0;
var URL = new Array();
URL[item++] = listitema.php ;
URL[item++] = listitemb.php.php ;
URL[item++] = listitemc.php ;
function randomJump() {
var random = rand(item) - 1;
location.href = URL[random];
};
<-end js file:->
查阅:
<a href="javascript:randomJump()" onmouseover="self.status= ;return true">
While this code works well for one link per page, I now need to have it work for multiple links, each with a different reference list. I have no idea how to make this a script that works for each link without interfering with other links. Thank you.