1. var links = new Array();
  2. links[1] = "<a href="http://tongji.baidu.com" target="_blank">http://tongji.baidu.com</a>";
  3. links[2] = "<a href="http://hi.baidu.com/bdadd/blog/item/6f9f80b12e50cf57092302e3.html" target="_blank">http://hi.baidu.com/bdadd/blog/item/6f9f80b12e50cf57092302e3.html</a>";
  4. links[3] = "<a href="http://union.baidu.com/promo/dataunion/index.html" target="_blank">http://union.baidu.com/promo/dataunion/index.html</a>";
  5. links[4] = "<a href="http://www.umaz.cn" target="_blank">http://www.umaz.cn</a>";
  6. var imgs = new Array();
  7. for(var n = 1; n <= 5; n++) imgs[n] = new Image();
  8. imgs[1].src = "<a href="http://union.baidu.com/img/tongji550.gif" target="_blank">http://union.baidu.com/img/tongji550.gif</a>";
  9. imgs[2].src = "<a href="http://union.baidu.com/img/banner071031.jpg" target="_blank">http://union.baidu.com/img/banner071031.jpg</a>";
  10. imgs[3].src = "<a href="http://union.baidu.com/img/dataunion0711.jpg" target="_blank">http://union.baidu.com/img/dataunion0711.jpg</a>";
  11. imgs[4].src = "<a href="http://union.baidu.com/img/umaz13_550.jpg" target="_blank">http://union.baidu.com/img/umaz13_550.jpg</a>";
  12. var tits = new Array();
  13. tits[1] ="百度统计";
  14. tits[2] = "联盟杯摄影师大赛";
  15. tits[3] = "百度行业报告";
  16. tits[4] = "联盟志";
  17.  
  18. var imgwidth = 550;//图片宽度
  19. var imgheight = 134;//图片宽度
  20.  
  21. var str = "<style type='text/css'>";
  22. str += "#imgnv{display:none;position:absolute;bottom:-1px;right:0;height:16px;}#imgnv div{float:left;margin-right:1px;}";
  23. str += "#imgnv div.on,#imgnv div.off{margin-bottom:1px;width:30px;height:15px;line-height:18px!important;line-height:15px;font-size:9px;text-align:center;cursor:pointer;cursor:hand}";
  24. str += "#imgnv div.on{background:#CE0609;color:#FFF;font-weight:bold}";
  25. str += "#imgnv div.off{background:#323232;color:#FFF;text-decoration:none}";
  26. str += "#titnv{margin-top:3px;color:#000;text-align:center;display:none;}";
  27. str += "</style>";
  28. str += "<div style='position:relative'>";
  29. str += "<div><a id='dlink' href='" + links[1] + "' target='_blank'><img id='dimg' src='" + imgs[1].src + "' border='0' width='" + imgwidth + "' height='"+imgheight+"' style='filter:Alpha(opacity=100)' onmouseover='Pause(true)' onmouseout='Pause(false)'></a></div>";
  30.  
  31. //修改点1:循环添加内层div内容以增加个数
  32. str += "<div id='imgnv'><div id='it1' class='on' onmouseover='ImgSwitch(1, true)' onmouseout='Pause(false)'>1</div><div id='it2' class='off' onmouseover='ImgSwitch(2, true)' onmouseout='Pause(false)'>2</div><div id='it3' class='on' onmouseover='ImgSwitch(3, true)' onmouseout='Pause(false)'>3</div><div id='it4' class='off' onmouseover='ImgSwitch(4, true)' onmouseout='Pause(false)'>4</div></div>";
  33. str += "<div id='titnv'><b>" + tits[1] + "</b></div>";
  34. str += "</div>";
  35. document.write(str);
  36.  
  37. var oi = document.getElementById("dimg");
  38. var pause = false;
  39. var curid = 1;
  40. var lastid = 1;
  41. var sw = 1;
  42. var opacity = 100;
  43. var speed = 15;
  44. var delay = (document.all)? 400:700;
  45.  
  46. function SetAlpha(){
  47. if(document.all){
  48. if(oi.filters && oi.filters.Alpha) oi.filters.Alpha.opacity = opacity;
  49. }else{
  50. oi.style.MozOpacity = ((opacity >= 100)? 99:opacity) / 100;
  51. }
  52. }
  53.  
  54. function ImgSwitch(id, p){
  55. if(p){
  56. pause = true;
  57. opacity = 100;
  58. SetAlpha();
  59. }
  60. oi.src = imgs[id].src;
  61. document.getElementById("dlink").href = links[id];
  62. document.getElementById("it" + lastid).className = "off";
  63. document.getElementById("it" + id).className = "on";
  64. document.getElementById("titnv").innerHTML = "<b>" + tits[id] + "</b>";
  65. curid = lastid = id;
  66. }
  67.  
  68. function ScrollImg(){
  69. if(pause && opacity >= 100) return;
  70. if(sw == 0){
  71. opacity += 2;
  72. if(opacity > delay){ opacity = 100; sw = 1; }
  73. }
  74. if(sw == 1){
  75. opacity -= 3;
  76. if(opacity < 10){ opacity = 10; sw = 3; }
  77. }
  78. SetAlpha();
  79. if(sw != 3) return;
  80. sw = 0;
  81. curid++;
  82. //修改点2:这里的4也是个数
  83. if(curid > 4) curid = 1;
  84. ImgSwitch(curid, false);
  85. }
  86.  
  87. function Pause(s){
  88. pause = s;
  89. }
  90.  
  91. function StartScroll(){
  92. setInterval(ScrollImg, speed);
  93. }
  94.  
  95. function CheckLoad(){
  96. if (imgs[1].complete == true && imgs[2].complete == true) {
  97. clearInterval(checkid);
  98. setTimeout(StartScroll, 2000);
  99. }
  100. }
  101.  
  102. var checkid = setInterval(CheckLoad, 10);


无觅相关文章插件,快速提升流量