1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
<style>#g_div { text-align:right; overflow:hidden } .b { width:24px; height:16px; background:#737373; font-size:14px; font-weight:bold; color:#fff; text-decoration:none; margin-left:1px } .b:hover { width:24px; height:16px; background:#780001; font-size:14px; font-weight:bold; color:#fff; text-decoration:none; margin-left:1px } .bhover { width:24px; height:16px; background:#780001; font-size:14px; font-weight:bold; color:#fff; text-decoration:none; margin-left: 1px } </style> <div id="g_div" style="width:270px;height:252px"> <a href="#" target='_blank'> <img id="g_img" style="FILTER:revealTrans(duration=1,transition=23);width:266px;height:220px;border:1px green solid" src="http://zi.csdn.net/xian.gif"></a> <a href="http://www.baidu.com/" for="http://zi.csdn.net/xian.gif" target="_blank">1.CSDN程序员</a> <a href="http://www.126.com/" for="http://zi.csdn.net/microsoft280_187.jpg" target="_blank">2.CSDN程序员</a> <a href="http://mp3.baidu.com/" for="http://zi.csdn.net/live.gif" target="_blank">3.CSDN程序员</a> <a href="http://post.baidu.com/" for="http://zi.csdn.net/new-mba.gif" target="_blank">4.CSDN程序员</a> <a href="http://top.baidu.com/" for="http://zi.csdn.net/book.jpg" target="_blank">5.CSDN程序员</a> </div> <script language="JavaScript"> function f() { var g_sec = 3; //几秒后切换图片 var g_items = new Array(); var g_div = document.getElementById("g_div"); var g_img = document.getElementById("g_img"); var g_imglink = g_img.parentElement; var arr = g_div.getElementsByTagName("A"); var arr_length = arr.length; var g_index = 1; var show_img = function(n) { if (/d+/.test(n)) { var prev = g_index + 1;g_index = n - 1 } else { var prev = (g_index > arr.length) ? (arr_length - 1) : g_index + 1; g_index = (g_index < arr_length - 2) ? (++g_index) : 0 } if (document.all) { g_img.filters.revealTrans.Transition = 23; g_img.filters.revealTrans.apply(); g_img.filters.revealTrans.play(); } arr[prev].className = "b"; arr[g_index + 1].className = "bhover"; g_img.src = g_items[g_index].img.src; g_img.title = g_items[g_index].txt; g_imglink.href = g_items[g_index].url; g_imglink.target = g_items[g_index].target; } for (var i = 1; i < arr_length; i++) { g_items.push({ txt: arr[i].innerHTML, url: arr[i].href, target: arr[i].target, img: (function() { var o = new Image; o.src = arr[i].getAttribute("for"); return o })() }) arr[i].title = arr[i].innerHTML; arr[i].innerHTML = [i, "?"].join(""); arr[i].className = "b"; arr[i].onclick = function() { event.returnValue = false; show_img(event.srcElement.innerText); } } show_img(1) var t = window.setInterval(show_img, g_sec * 1000); g_img.onmouseover = function() { window.clearInterval(t); } g_img.onmouseout = function() { t = window.setInterval(show_img, g_sec * 1000); } } window.attachEvent("onload", f); </script> |