Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title></title>
</head>
<body>
<script type="text/javascript">
var A1= [
["image1.jpg", "http://site1.com"],
["image2.jpg", "http://site2.com"],
["image3.jpg", "http://site3.com"],
["image4.jpg", "http://site4.com"],
["image5.jpg", "http://site5.com"],
["image6.jpg", "http://site6.com"],
["image7.jpg", "http://site7.com"]
]
function shuffle(ary){
for (var r,t,z0=0;z0<ary.length;z0++){
r=Math.floor(Math.random()*ary.length);
t=ary[z0];
ary[z0]=ary[r];
ary[r]=t;
}
return ary;
}
A1=shuffle(A1);
A1.length=4;
alert(A1.join('\n'));
//then use
//imagearray:A1,
</script>
</body>
</html>
Bookmarks