效果图: 兼容FF和IE浏览器
[CODE:]
<script type="text/javascript">
var isIE=!(navigator.userAgent.indexOf('MSIE')==-1);
if(isIE){
document.onreadystatechange = function () {
if (document.readyState=="complete")
{
inlist();
}
};
}else{
window.onload = function () {
inlist();
};
}
var imgUrl=new Array();
var imgLink=new Array();
var imgTz=new Array();
imgUrl[1]="1.jpg";
imgLink[1]="";
imgTz[1]="ձQQռг";
imgUrl[2]="2.jpg";
imgLink[2]="";
imgTz[2]="˼кչ";
imgUrl[3]="3.jpg";
imgLink[3]="";
imgTz[3]="úͳһԴ˷?";
imgUrl[4]="4.jpg";
imgLink[4]="";
imgTz[4]="ɽߺGDPԾ";
imgUrl[5]="5.jpg";
imgLink[5]="";
imgTz[5]="ɽߺGDPԾ";
imgUrl[6]="6.jpg";
imgLink[6]="";
imgTz[6]="ɽߺGDPԾ";
var imgcount = imgUrl.length-1;
function inlist(){
var i;
for(i=imgcount;i>=1;i--){
var list = document.getElementById("list");
var tz = document.createElement("div");
if(i==1){
tz.className = "zi1";
}else{
tz.className = "zi";
}
tz.setAttribute("id", "zi"+i);
tz.innerHTML = "+i+");\" class=\"wenzi\">"+i+"";
list.appendChild(tz);
}
}
function showpic(a){
var j;
for(j=1;j<=imgcount;j++){ //循环加css 总数为imcount条
var list = document.getElementById("zi"+j);
list.className = "zi";
}
var list = document.getElementById("zi"+a); //CLASS名
list.className = "zi1";
var pic = document.getElementById("pic"); //图片
pic.setAttribute("src", imgUrl[a]);
var pic_link = document.getElementById("pic_link"); //链接
pic_link.setAttribute("href", imgLink[a]);
var tz = document.getElementById("texts"); //文字
tz.innerHTML = "+imgLink[a]+" class=\"biaot\">"+imgTz[a]+"";
}
var i=1;
var timer;
function xh(){ //
i++;
if(i>=imgcount+1){
i = 1;
// clearTimeout(timer);
// return;
}
var j;
for(j=1;j<=imgcount;j++){ //
var list = document.getElementById("zi"+j);
list.className = "zi";
}
var list = document.getElementById("zi"+i); //字体
list.className = "zi1";
var pic = document.getElementById("pic"); //图片
pic.setAttribute("src", imgUrl[i]);
var pic_link = document.getElementById("pic_link"); //图片链接地址
pic_link.setAttribute("href", imgLink[i]);
var tz = document.getElementById("texts"); //文字
tz.innerHTML = "+imgLink[i]+" class=\"biaot\">"+imgTz[i]+"";
setTimeout('xh()', 10000); //
}
timer = setTimeout('xh()', 10000); //每10秒换一张图
var isIE=!(navigator.userAgent.indexOf('MSIE')==-1);
if(isIE){
document.onreadystatechange = function () {
if (document.readyState=="complete")
{
inlist();
}
};
}else{
window.onload = function () {
inlist();
};
}
var imgUrl=new Array();
var imgLink=new Array();
var imgTz=new Array();
imgUrl[1]="1.jpg";
imgLink[1]="";
imgTz[1]="ձQQռг";
imgUrl[2]="2.jpg";
imgLink[2]="";
imgTz[2]="˼кչ";
imgUrl[3]="3.jpg";
imgLink[3]="";
imgTz[3]="úͳһԴ˷?";
imgUrl[4]="4.jpg";
imgLink[4]="";
imgTz[4]="ɽߺGDPԾ";
imgUrl[5]="5.jpg";
imgLink[5]="";
imgTz[5]="ɽߺGDPԾ";
imgUrl[6]="6.jpg";
imgLink[6]="";
imgTz[6]="ɽߺGDPԾ";
var imgcount = imgUrl.length-1;
function inlist(){
var i;
for(i=imgcount;i>=1;i--){
var list = document.getElementById("list");
var tz = document.createElement("div");
if(i==1){
tz.className = "zi1";
}else{
tz.className = "zi";
}
tz.setAttribute("id", "zi"+i);
tz.innerHTML = "+i+");\" class=\"wenzi\">"+i+"";
list.appendChild(tz);
}
}
function showpic(a){
var j;
for(j=1;j<=imgcount;j++){ //循环加css 总数为imcount条
var list = document.getElementById("zi"+j);
list.className = "zi";
}
var list = document.getElementById("zi"+a); //CLASS名
list.className = "zi1";
var pic = document.getElementById("pic"); //图片
pic.setAttribute("src", imgUrl[a]);
var pic_link = document.getElementById("pic_link"); //链接
pic_link.setAttribute("href", imgLink[a]);
var tz = document.getElementById("texts"); //文字
tz.innerHTML = "+imgLink[a]+" class=\"biaot\">"+imgTz[a]+"";
}
var i=1;
var timer;
function xh(){ //
i++;
if(i>=imgcount+1){
i = 1;
// clearTimeout(timer);
// return;
}
var j;
for(j=1;j<=imgcount;j++){ //
var list = document.getElementById("zi"+j);
list.className = "zi";
}
var list = document.getElementById("zi"+i); //字体
list.className = "zi1";
var pic = document.getElementById("pic"); //图片
pic.setAttribute("src", imgUrl[i]);
var pic_link = document.getElementById("pic_link"); //图片链接地址
pic_link.setAttribute("href", imgLink[i]);
var tz = document.getElementById("texts"); //文字
tz.innerHTML = "+imgLink[i]+" class=\"biaot\">"+imgTz[i]+"";
setTimeout('xh()', 10000); //
}
timer = setTimeout('xh()', 10000); //每10秒换一张图