|
Ad.js- //鼠标移过来的动作。显示当前图片,清除轮询。
- function adchangea(adid) {
- dochange(adid);
- clearTimeout(adisround);
- }
- //自动轮询
- function adchangea2(adid) {
- dochange(adid);
- var adbigimg = document.getElementById("adpica").getElementsByTagName("div");
- if ((adnext = adid + 1) > adbigimg.length) adnext = 1;
- adisround = setTimeout('adchangea2(' + adnext + ')', 3000);
- }
- //显示当前图片
- function dochange(adid) {
- id = adid;
- var adbigimg = document.getElementById("adpica").getElementsByTagName("div");
- var adsmallimg = document.getElementById("adtipa").getElementsByTagName("li");
- if (adbigimg && adsmallimg) {
- for (var adi = 0; adi < adbigimg.length; adi++) {
- adbigimg[adi].className = "hidden";
- adsmallimg[adi].className = "";
- }
- adbigimg[adid - 1].className = "show";
- adsmallimg[adid - 1].className = "current";
- }
- }
- var adisround = setTimeout("adchangea2(2)", 3000);
- var id; //当前激活id
- //鼠标移开ul块时,恢复轮询
- function change() {
- adchangea2(id);
- }
复制代码 |
|