下面的代码在ie里面切换正常,但是在火狐里面能切换,不过位置混乱了,和网页其他位置重叠了,js代码如下
var imgWidth=720;
var imgHeight=500;
var textFromHeight=21;
var textStyle="bt_link";
var textLinkStyle="FONT";
var buttonLineOn="#ce0609";
var buttonLineOff="#000";
var TimeOut=5000;
var imgUrl=new Array();
var imgLink=new Array();
var imgtext=new Array();
var imgAlt=new Array();
var adNum=0;
var theTimer=0;
var tt=1; document.write('<style type="text/css">');
document.write('#focuseFrom{width:'+(imgWidth+2)+';margin: 0px; padding:0px;height:'+(imgHeight+textFromHeight)+'px; overflow:hidden;}');
document.write('#txtFrom{height:'+textFromHeight+'px;line-height:'+textFromHeight+'px;width:'+imgWidth+'px;overflow:hidden;}');
document.write('#imgTitle{width:'+imgWidth+';top:-'+(textFromHeight+12)+'px;height:18px}');
document.write('</style>');
document.write('<div id="focuseFrom">');
tt=1;
imgUrl[tt] ='images/hb1.jpg';
imgtext[tt]=' 07/0832132';
imgLink[tt]='http://www.geili724.com';
imgAlt[tt]='07/0832132';
tt=2;
imgUrl[tt] ='images/hb2.jpg';
imgtext[tt]=' 321321';
imgLink[tt]='http://www.geili724.com';
imgAlt[tt]='2312';
tt=3;
imgUrl[tt] ='images/hb3.jpg';
imgtext[tt]=' 32132';
imgLink[tt]='http://www.geili724.com';
imgAlt[tt]='123';
tt=4;
imgUrl[tt] ='images/hb4.jpg';
imgtext[tt]=' 07/081';
imgLink[tt]='http://www.geili724.com';
imgAlt[tt]='07/08';
tt=5;
imgUrl[tt] ='images/hb5.jpg';
imgtext[tt]=' 07/08';
imgLink[tt]='http://www.geili724.com';
imgAlt[tt]='07/08';
var intPage =0;
for (var i=1;i<=imgUrl.length;i++)
{
if (imgUrl[i]!="!!!")
{
intPage++;
}
}
function changeimg(n)
{
adNum=n;
window.clearInterval(theTimer);
adNum=adNum-1;
nextAd();
}
function goUrl(){
window.open(imgLink[adNum],'_blank');
}
if (navigator.appName == "Netscape")
{
document.write('<style type="text/css">');
document.write('.buttonDiv{height:4px;width:21px;}');
document.write('</style>');
function nextAd(){
if(adNum<(intPage-1))adNum++;
else adNum=1;
theTimer=setTimeout("nextAd()", TimeOut);
document.images.imgInit.src=imgUrl[adNum];
document.images.imgInit.alt=imgAlt[adNum];
document.getElementById('focustext').innerHTML=imgtext[adNum];
document.getElementById('link'+adNum).style.background=buttonLineOn;
document.getElementById('imgLink').href=imgLink[adNum];
for (var i=1;i<=intPage;i++)
{
if (i!=adNum){document.getElementById('link'+i).style.background=buttonLineOff;}
}
}
document.write('<a id="imgLink" href="'+imgLink[1]+'" target=_blank class="p1"><img src="imgUrl[1]" name="imgInit" border=1 alt="'+imgAlt[1]+'" class="imgClass"></a><div id="txtFrom"><span id="focustext" class="'+textStyle+'">'+imgtext[1]+'</span></div>')
document.write('<div id="imgTitle">');
document.write('<div id="imgTitle_down">');
for(var i=1;i<intPage;i++){document.write('<a href="javascript:changeimg('+i+')" class="button" style="cursor:hand" title="'+imgAlt[i]+'">'+i+'</a>');}
document.write('</div>');
document.write('</div>');
document.write('</div>');
nextAd();
}
else
{
var count=0;
for (i=1;i<intPage;i++) {
if( (imgUrl[i]!="") && (imgLink[i]!="")&&(imgtext[i]!="")&&(imgAlt[i]!="") ) {
count++;
} else {
break;
}
}
function playTran(){
if (document.all)
document.images.imgInit.filters.BlendTrans.play();
}
var key=0;
function nextAd(){
if(adNum<count)adNum++ ;
else adNum=1;
if( key==0 ){
key=1;
} else if (document.all){
//imgInit.filters.revealTrans.Transition=6;
document.images.imgInit.filters.BlendTrans.apply();
playTran();
}
document.images.imgInit.src= imgUrl[adNum];
document.images.imgInit.alt=imgAlt[adNum];
document.getElementById('link'+adNum).style.background=buttonLineOn;
for (var i=1;i<=count;i++)
{
if (i!=adNum){document.getElementById('link'+i).style.background=buttonLineOff;}
}
focustext.innerHTML=imgtext[adNum];
//links_ie_font.links=imglink[adNum];
theTimer=setTimeout("nextAd()", TimeOut);
}
document.write('<a target=_self href="javascript:goUrl()"><img style="FILTER: BlendTrans ( duration=1 );" src="javascript:nextAd()" border=0 vspace="0" name=imgInit class="imgClass"></a>');
document.write('<div id="txtFrom"><a target=_self href="javascript:goUrl()"><span id="focustext" class="'+textStyle+'"></span></a></div>');
document.write('<div id="imgTitle">');
document.write(' <div id="imgTitle_down"> <a class="trans"" style="float:left"><img src="images/ljpd.gif" border=0></a>');
for(var i=1;i<intPage;i++){document.write('<a id="link'+i+'" href="javascript:changeimg('+i+')" class="button" style="cursor:hand" title="'+imgAlt[i]+'" onFocus="this.blur()">'+i+'</a>');}
document.write('</div>');
document.write('</div>');
document.write('</div>');
changeimg(1);
}
怎么让他兼容火狐呢
var imgWidth=720;
var imgHeight=500;
var textFromHeight=21;
var textStyle="bt_link";
var textLinkStyle="FONT";
var buttonLineOn="#ce0609";
var buttonLineOff="#000";
var TimeOut=5000;
var imgUrl=new Array();
var imgLink=new Array();
var imgtext=new Array();
var imgAlt=new Array();
var adNum=0;
var theTimer=0;
var tt=1; document.write('<style type="text/css">');
document.write('#focuseFrom{width:'+(imgWidth+2)+';margin: 0px; padding:0px;height:'+(imgHeight+textFromHeight)+'px; overflow:hidden;}');
document.write('#txtFrom{height:'+textFromHeight+'px;line-height:'+textFromHeight+'px;width:'+imgWidth+'px;overflow:hidden;}');
document.write('#imgTitle{width:'+imgWidth+';top:-'+(textFromHeight+12)+'px;height:18px}');
document.write('</style>');
document.write('<div id="focuseFrom">');
tt=1;
imgUrl[tt] ='images/hb1.jpg';
imgtext[tt]=' 07/0832132';
imgLink[tt]='http://www.geili724.com';
imgAlt[tt]='07/0832132';
tt=2;
imgUrl[tt] ='images/hb2.jpg';
imgtext[tt]=' 321321';
imgLink[tt]='http://www.geili724.com';
imgAlt[tt]='2312';
tt=3;
imgUrl[tt] ='images/hb3.jpg';
imgtext[tt]=' 32132';
imgLink[tt]='http://www.geili724.com';
imgAlt[tt]='123';
tt=4;
imgUrl[tt] ='images/hb4.jpg';
imgtext[tt]=' 07/081';
imgLink[tt]='http://www.geili724.com';
imgAlt[tt]='07/08';
tt=5;
imgUrl[tt] ='images/hb5.jpg';
imgtext[tt]=' 07/08';
imgLink[tt]='http://www.geili724.com';
imgAlt[tt]='07/08';
var intPage =0;
for (var i=1;i<=imgUrl.length;i++)
{
if (imgUrl[i]!="!!!")
{
intPage++;
}
}
function changeimg(n)
{
adNum=n;
window.clearInterval(theTimer);
adNum=adNum-1;
nextAd();
}
function goUrl(){
window.open(imgLink[adNum],'_blank');
}
if (navigator.appName == "Netscape")
{
document.write('<style type="text/css">');
document.write('.buttonDiv{height:4px;width:21px;}');
document.write('</style>');
function nextAd(){
if(adNum<(intPage-1))adNum++;
else adNum=1;
theTimer=setTimeout("nextAd()", TimeOut);
document.images.imgInit.src=imgUrl[adNum];
document.images.imgInit.alt=imgAlt[adNum];
document.getElementById('focustext').innerHTML=imgtext[adNum];
document.getElementById('link'+adNum).style.background=buttonLineOn;
document.getElementById('imgLink').href=imgLink[adNum];
for (var i=1;i<=intPage;i++)
{
if (i!=adNum){document.getElementById('link'+i).style.background=buttonLineOff;}
}
}
document.write('<a id="imgLink" href="'+imgLink[1]+'" target=_blank class="p1"><img src="imgUrl[1]" name="imgInit" border=1 alt="'+imgAlt[1]+'" class="imgClass"></a><div id="txtFrom"><span id="focustext" class="'+textStyle+'">'+imgtext[1]+'</span></div>')
document.write('<div id="imgTitle">');
document.write('<div id="imgTitle_down">');
for(var i=1;i<intPage;i++){document.write('<a href="javascript:changeimg('+i+')" class="button" style="cursor:hand" title="'+imgAlt[i]+'">'+i+'</a>');}
document.write('</div>');
document.write('</div>');
document.write('</div>');
nextAd();
}
else
{
var count=0;
for (i=1;i<intPage;i++) {
if( (imgUrl[i]!="") && (imgLink[i]!="")&&(imgtext[i]!="")&&(imgAlt[i]!="") ) {
count++;
} else {
break;
}
}
function playTran(){
if (document.all)
document.images.imgInit.filters.BlendTrans.play();
}
var key=0;
function nextAd(){
if(adNum<count)adNum++ ;
else adNum=1;
if( key==0 ){
key=1;
} else if (document.all){
//imgInit.filters.revealTrans.Transition=6;
document.images.imgInit.filters.BlendTrans.apply();
playTran();
}
document.images.imgInit.src= imgUrl[adNum];
document.images.imgInit.alt=imgAlt[adNum];
document.getElementById('link'+adNum).style.background=buttonLineOn;
for (var i=1;i<=count;i++)
{
if (i!=adNum){document.getElementById('link'+i).style.background=buttonLineOff;}
}
focustext.innerHTML=imgtext[adNum];
//links_ie_font.links=imglink[adNum];
theTimer=setTimeout("nextAd()", TimeOut);
}
document.write('<a target=_self href="javascript:goUrl()"><img style="FILTER: BlendTrans ( duration=1 );" src="javascript:nextAd()" border=0 vspace="0" name=imgInit class="imgClass"></a>');
document.write('<div id="txtFrom"><a target=_self href="javascript:goUrl()"><span id="focustext" class="'+textStyle+'"></span></a></div>');
document.write('<div id="imgTitle">');
document.write(' <div id="imgTitle_down"> <a class="trans"" style="float:left"><img src="images/ljpd.gif" border=0></a>');
for(var i=1;i<intPage;i++){document.write('<a id="link'+i+'" href="javascript:changeimg('+i+')" class="button" style="cursor:hand" title="'+imgAlt[i]+'" onFocus="this.blur()">'+i+'</a>');}
document.write('</div>');
document.write('</div>');
document.write('</div>');
changeimg(1);
}
怎么让他兼容火狐呢
charset "gbk";
/* CSS Document */
/* 公共样式表 */
body {text-align: left; font-family:"宋体", arial; margin:0; padding:0; background:#FFF; }div,form,img,ul,ol,li,dl,dt,dd {margin:0; padding:0; border:0; }li,dl{list-style-type:none;}
h2,h3,h4,h5,h6 { margin:0; padding:0; font-weight:normal;}
p{margin:0;padding:0}
h1{margin:0; padding:0;}
a{ text-decoration:none;}/* 公共样式中的默认超链接 */a:link { text-decoration:none;}
a:visited {text-decoration:none;}
a:hover {text-decoration:underline;}.fl{ float:left; display:inline; color:#000; font-size:14px;}
.tbsc{ font-size:12px; color:#555555; margin-top:5px;}
.fr{ float:right; display:inline; color:#000; }
.gd{ float:right; font-size:13px; display:inline; margin-right:15px; line-height:33px; color:#000;}
.hy{font-size:13px; color:#aaabb2; line-height:33px; margin-left:170px; float:left;}
/* 样式表 */
.big{ width:100%;min-width:1340px;background:#FFFFFF; margin:0 auto; }
.top{ width:100%; height:195px; background:url(../images/top_top.jpg) repeat-x; height:33px; border-bottom:1px solid #cdc9ca;}
.top ul{ float:right; margin-right:135px; width:282px;}
.top ul li{ float:left; margin-left:15px; font-size:12px; color:#999; line-height:33px;}
.top ul li a{ font-size:12px; color:#999; line-height:33px;}
.center{ width:1001px; margin:0 auto; }
.center_top{ width:1001px;}
.center_top_left{ background:url(../images/logo.jpg) no-repeat; width:234px; height:124px; float:left;}
.center_top_center{ width:490px; height:125px; float:left;}
.center_top_center ul{ margin-top:50px; margin-left:50px;}
.center_top_center ul li{ float:left; margin-left:8px; font-size:13px; color:#666; }
.center_top_center ul li a{ font-size:13px; color:#726c6f; }
.center_top_center ul li a:hover{ font-weight:bold;}
.btn{ background-image:url(../images/btn.jpg); background-repeat:no-repeat; border:0px; width:317px; height:32px; float:left; margin-left:50px; margin-top:10px; font-size:18px; line-height:32px;}
.btn1{ background:url(../images/btn1.jpg); border:0; width:79px; height:32px; float:left; margin-top:10px;}
.center_top_right{ background:url(../images/top_right.jpg) no-repeat; width:246px; height:124px; float:right;}
.center_top_bottom{ background:url(../images/nav.jpg) repeat-x; width:100%; height:36px; float:left; border-bottom:#726c6e solid 2px;}
.center_top_bottom_left{ float:left; width:530px;}
.center_top_bottom_left ul{}
.center_top_bottom_left ul li{ margin-left:10px; line-height:36px; font-size:14px; color:#000; float:left; display:inline;}
.center_top_bottom_left ul li a{ line-height:36px; font-size:14px; color:#000;}
.center_top_bottom_left ul li a:hover{ color:#c01414; font-weight:bold;}.center_top_bottom_right { background:url(../images/dh.jpg) no-repeat; width:141px; height:33px; line-height:36px; float:right; margin-right:5px;}
.center_center{ width:1001px;}
.center_center_left{ float:left;width:740px; margin-right:15px;}
.center_center_left_top{ float:left; width:740px; margin-top:12px;}
.center_center_left_top_left{ float:left;width:532px; height:360px;}
.center_center_left_top_right{ float:left;width:532px; height:360px;}
.center_center_left_top_right_top{ background:url(../images/banner2.jpg) no-repeat; width:207px; height:132px;}
.center_center_left_top_right_center{ background:url(../images/banner3.jpg) no-repeat; width:207px; height:132px;}
.center_center_left_top_right_bottom{ background:url(../images/banner4.jpg) no-repeat; width:207px; height:96px;}/*中间*/
.center_center_left_center{ background:url(../images/dzp.jpg); width:739px; height:177px; float:left; margin-top:3px;}
.center_center_left_bottom{ margin-top:10px;}
.center_center_left_bottom_top{ float:left; border-bottom:2px solid #666; margin-top:15px;font-weight:bold; font-size:12px;}
.center_center_left_bottom_top .biaoti_001{ width:739px; height:20px;}.center_center_left_bottom_center{ margin-top:5px; width:740px;}
.center_center_left_bottom_center_left{ border:1px solid #999; width:238px; height:230px; float:left; margin-top:10px;}
.center_center_left_bottom_center_left_top img{ width:233px; height:149px; margin-left:3px; margin-top:5px; margin-bottom:5px;}
.center_center_left_bottom_center_left_bottom { line-height:22px;}
.center_center_left_bottom_center_left_bottom p{ font-size:12px; color:#0567a6; line-height:25px; margin-left:8px; width:230px;}
.center_center_left_bottom_center_left_bottom h3{ font-size:12px; color:#000; width:230px; line-height:22px;}
.center_center_left_bottom_center_left_bottom span{ margin-left:8px; line-height:20px; width:230px; height:14px; }
.center_center_left_bottom_center_center{ border:1px solid #999; width:239px; height:230px; float:left; margin-top:10px; margin-left:6px;}
.center_center_left_bottom_center_center_top img{ width:233px; height:149px; margin-left:3px; margin-top:5px; margin-bottom:5px;}
.center_center_left_bottom_center_center_bottom { line-height:22px;}
.center_center_left_bottom_center_center_bottom p{ font-size:12px; color:#0567a6; line-height:25px; margin-left:8px; width:230px;}
.center_center_left_bottom_center_center_bottom h3{ font-size:12px; color:#000; width:230px; line-height:22px;}
.center_center_left_bottom_center_center_bottom span{ margin-left:8px; line-height:20px; width:230px; height:14px; }
.center_center_left_bottom_center_right{ border:1px solid #999; width:238px; height:230px; float:left; margin-top:10px; margin-left:6px;}
.center_center_left_bottom_center_right_top img{ width:233px; height:149px; margin-left:3px; margin-top:5px; margin-bottom:5px;}
.center_center_left_bottom_center_right_bottom { line-height:22px;}
.center_center_left_bottom_center_right_bottom p{ font-size:12px; color:#0567a6; line-height:25px; margin-left:8px; width:220px;}
.center_center_left_bottom_center_right_bottom h3{ font-size:12px; color:#000; line-height:22px;}
.center_center_left_bottom_center_right_bottom span{ margin-left:8px; line-height:20px; }
.center_center_left_bottom_bottom{ width:738px; float:left;}
.center_center_left_bottom_bottom_left{float:left;}
.center_center_left_bottom_bottom_left ul{ margin-top:13px; margin-bottom:5px;}
.center_center_left_bottom_bottom_left ul li{ background:url(../images/jt.jpg) no-repeat; margin-top:6px; line-height:12px;}
.center_center_left_bottom_bottom_left ul li a{ font-size:14px; margin-left:15px; color:#227760;}.center_center_left_bottom_bottom_right{ float:right; display:inline;}
.center_center_left_bottom_bottom_right ul{ margin-top:13px; color:#207860; margin-bottom:5px;}
.center_center_left_bottom_bottom_right ul li{ background:url(../images/jt.jpg) no-repeat left center; margin-top:6px; line-height:12px; color:#207860;}
.center_center_left_bottom_bottom_right ul li a{ font-size:14px; margin-left:15px; color:#207860;}.center_center_right{ float:left; width:245px; margin-top:12px;}
.center_center_right_top{ width:243px; height:166px; border:1px solid #cccccc; margin-bottom:15px;}
.center_center_right_top_top{ background:url(../images/right.jpg) repeat-x; width:243px; height:33px; border-bottom:1px solid #726c6e;}
.zhsj{ font-size:14px; font-weight:bold; line-height:33px; margin-left:5px; float:left; color:#000;}
.tb{ padding-left:3px; }
.tb li{ width:100px; height:50px; float:left; display:inline; margin-top:10px;margin-left:14px; font-size:14px; text-align:center;}
.tb img{ width:90px; height:27px; border:2px solid #eeeeee; padding:1px; }
.center_center_right_bottom{ float:left; width:243px; height:400px; border:1px solid #cccccc; margin-bottom:15px;}
.center_center_right_bottom_top{background:url(../images/right.jpg) repeat-x; width:243px; height:33px; border-bottom:1px solid #726c6e;}
.rmhd{ font-size:14px; line-height:33px; margin-left: 65px; font-weight:bold; color:#c01414;}
.center_center_right_bottom ul{ float:left; margin-top:10px;}
.center_center_right_bottom li{ line-height:25px; font-size:12px; margin-left:6px; border-bottom:1px dashed #e0e0e0; width:220px; height:25px;}
.center_center_right_bottom li a{ font-size:13px; color:#333333;}
.gdhd{ color:#e1b10a; float:right; margin-right:25px; margin-top:10px; font-size:12px; height:25px; }
.bottom{ width:100%; margin-top:10px; height:60px; float:left; border-top:1px solid #c6cad6; text-align:center;}
.bottom ul{margin-top:10px; padding-left:460px;}
.bottom ul li{ float:left; text-align:center; margin-left:10px; font-size:13px; color:#9fa0a2;}
.bottom ul li a{ font-size:13px; color:#9fa0a2;}
.ba{ text-align:center; float:left; width:100%; margin-top:10px; margin-bottom:8px; font-size:13px; color:#9fa0a2;}
/* 滤镜 */
/* 数字按钮框样式 */
#imgTitle {FILTER:ALPHA(opacity=70);position:relative;left:0px;text-align:left;overflow: hidden;}
#imgTitle_up {left:0px;text-align: left; height:1px; width:inherit; }
#imgTitle_down {left:0px;text-align: right; width:inherit; }
/* 图片框样式 */
.imgClass {border: 0px solid #000;}
/* 图片文字框样式 */
#txtFrom {text-align: center;vertical-align: middle; color:#333333}
/* 数字按钮样式 */
.button {text-decoration: none; float:left; height:12px; line-height:12px; padding-left:7px; padding-right:6px;background: #7B7B63;margin: 0px;font: bold 9px sans-serif; border-left:#fff 1px solid;}
a.button, a.button:link, a.button:visited {font-family: sans-serif;text-decoration: none;color:#FFFFFF;background-color: #000000;}
a.button:hover {font-family: sans-serif;text-decoration: none;color:#fff;background:#fff; }
.buttonDiv {background: #000000;height: 1px;width: 21px;float: left;text-align: center; vertical-align: middle;}
/*渐变*/
.trans { width:88px; height:12px; overflow:hidden}