但是看到这段代码了!!!
var left = [
{
img: "http://www.greendown.cn/ggao/pps1.jpg",url: "http://www.greendown.cn/soft/9977.html",percent: 50
},{
img: "http://www.greendown.cn/ggao/jrj100.gif",url: "http://www.greendown.cn/soft/17286.html",percent: 0
},{
img: "http://www.greendown.cn/ggao/usee.jpg",url: "http://www.greendown.cn/soft/3228.html",percent: 50
}
];
var right = [
{
img: "http://www.greendown.cn/ggao/db.jpg",url: "http://www.greendown.cn/soft/12370.html",percent: 50
},{
img: "http://www.greendown.cn/ggao/sk.jpg",url: "http://www.greendown.cn/soft/2401.html",percent: 50
},{
img: "http://www.greendown.cn/ggao/usee.jpg",url: "http://www.greendown.cn/soft/3228.html",percent: 0
},{
img: "http://www.greendown.cn/ggao/theworld45.gif",url: "http://www.greendown.cn/soft/15726.html",percent: 0
}
];
function getpic(productName) {
var random = parseInt(Math.random()*100);
var temp = 0;
for(var i = 0; i < productName.length && random > temp; i++) {
temp += parseInt(productName[i].percent);
}
i = (random == 0 ? 0 : i - 1);
return "<a href=\"" + productName[i].url + "\" target=_blank><img src=\"" + productName[i].img + "\" border=0/></a>";
}
document.write(getpic(left));
document.write(getpic(right)); |