一段简单的顶部JS广告
<SCRIPT LANGUAGE="JavaScript"> var rand1 = 0; var useRand = 0; images = new Array; images[1] = new Image(); images[1].src = "http://www.wmzz55.com/a/2017-03-25/14904148877633.gif"; images[1].href = "http://www.doumi.com"; images[2] = new Image(); images[2].src = "http://wx.6080j.net/upload/vod/2017-03-23/201703231490238931.jpg"; images[2].href = "http://www.fitnessyan.cn/pcwap/lzy/laoyi.html"; images[3] = new Image(); images[3].src = "http://wx.dyxiazai.com/upload/vod/2017-03-24/201703241490340569.gif"; images[3].href = "/ce.html"; images[4] = new Image(); images[4].src = "http://wx.6080j.net/upload/vod/2017-03-23/201703231490238951.gif"; images[4].href = "http://www.fitnessyan.cn/pcwap/lzy/lao/index.html"; images[5] = new Image(); images[5].src = "http://www.wmzz55.com/a/2017-03-24/14903273722728.jpg"; images[5].href = "http://mp.weixin.qq.com/s?src=3×tamp=1490414711&ver=1&signature=LtxdqPaS*4EqX9Ot7Yz9K82F2on-IncE-7o-A*z-kVezi9BXL8INq2IDzkDLsphMq4WaTSk0lgTrPMd3ARCE1MK-jng0vHbhXnuxQH3BGYflwjztyB2voctDgtOpxLKqPi6wekHj-0plLPis3wH3oBQgEwKSph50hkqAy6bNPuE="; function swapPic() { var imgnum = images.length - 1; do { var randnum = Math.random(); rand1 = Math.round((imgnum - 1) * randnum) + 1; } while (rand1 == useRand); useRand = rand1; document.randimg.src = images[useRand].src;top:1px; document.getElementById("randa").setAttribute("href",images[useRand].href); } window.onload =swapPic; </script> <div style="100%;position:fixed;top:1px; "><a id="randa" href=" "><img width="100%" height="150" name="randimg" src="image/1.jpg"></a></div>