ads = new Array(); ads[0]="随机广告测试"; index = Math.floor(Math.random() * ads.length); document.write(ads[index]);