javascript 图片滑动切换代码
nVida网站图片滑动-http://www.jb51.net
#changebox{width:610px;height:342px;overflow:hidden; position:relative;}
#changebox #changeAction{width:1220px;height:342px; position:absolute; }
#changebox #changeAction #links{width:610px;height:342px;background:#000000; float:left;font:700 55px Arial, Helvetica, sans-serif; color:#FFFFFF;text-align:center;}
#changebox #changeAction #links #threePro{ height:194px;float:left;}
#changebox #changeAction #links #threePro dl{width:203px; height:190px; margin:0; padding:0; float:left;}
#changebox #changeAction #links #threePro dl dt{width:203px;height:150px;margin:0;padding:0;float:left;overflow:hidden;position:relative;}
#changebox #changeAction #links #threePro dl dt #Motherboard{margin:0 0 0 7px;position:absolute;left:0;top:0; text-align:center; float:left;}
#changebox #changeAction #links #threePro dl dt #GraphicsCard{margin:0 0 0 7px;position:absolute;left:-203px;top:0; text-align:center; float:left;}
#changebox #changeAction #links #threePro dl dt #Notebook{margin:0 0 0 7px;position:absolute;left:-410px;top:0; text-align:center; float:left;}
#changebox #changeAction #links #threePro dl dd{width:147px;height:23px; background:url(indexPic.gif) 0 -339px; text-align:center;font:700 14px Verdana, Arial, Helvetica, sans-serif; color:#FFFFFF; padding:6px 0 0 0; margin:0 0 0 30px;cursor:pointer;}
#changebox #changeAction #links #support{width:600px; height:28px; overflow:hidden; position:relative; background:url(indexPic.gif) 0 -300px;font:700 15px Arial, Helvetica, sans-serif; color:#FFCC00; padding:10px 0 0 10px;}
#changebox #changeAction #links #support img{ position:absolute; left:0; top:-300px;}
#changebox #changeAction #links ul{width:203px; margin:0; padding:0; float:left;}
#changebox #changeAction #links ul li{ list-style:none;width:203px; margin:0; padding:0; float:left; color:#FFCC00; font:700 14px Arial, Helvetica, sans-serif; text-align:center;}
#changebox #changeAction #links ul li.nVidia{width:126px;height:100px;overflow:hidden;position:relative;margin:0 0 10px 40px; padding:0; }
#changebox #changeAction #links ul li.nVidia img{position:absolute; bottom:0; right:0;}
#changebox #changeAction #links ul li.button{width:122px; height:20px; padding:4px 0 0 0; margin:0 0 10px 42px; overflow:hidden; background:url(indexPic.gif) 0 -369px; font:700 12px Arial, Helvetica, sans-serif;text-align:center;color:#FFFFFF; cursor:pointer;}
#schoolButton{ color:#FFFFFF;width:50px; height:18px; font:700 12px Arial, Helvetica, sans-serif; background: #006600; text-align:center; padding:2px 0 0 0; margin:0 10px 0 0; float:left; cursor:pointer;}
#schoolButton:hover{ background: #FFFF00; color:#000000;}
#indexButton{ color:#FFFFFF;width:50px; height:18px; font:700 12px Arial, Helvetica, sans-serif; background: #006600; text-align:center; padding:2px 0 0 0; margin:0 10px 0 0; float:left; cursor:pointer;}
#indexButton:hover{ background: #FFFF00; color:#000000;}
#changebox #changeAction #links2{width:610px;height:342px; float:left; background:#333;font:700 55px Arial, Helvetica, sans-serif; color:#FFFFFF; text-align:center;}
var tt;
function move(){
var obj = document.getElementById('changeAction');
if(parseInt(obj.style.left) -610){
obj.style.left = parseInt(obj.style.left) - 10 + "px";
}
}
function button1click(){
clearInterval(tt);
tt = setInterval('move()',1);
document.getElementById("indexButton").style.display = "none";
document.getElementById("schoolButton").style.display = "block";
}
function button2click(){
clearInterval(tt);
tt=setInterval('move2()',1);
document.getElementById("indexButton").style.display = "block";
document.getElementById("schoolButton").style.display = "none";
}
1
2
[Ctrl+A 全选 注:如需引入外部Js需刷新才能执行]