绿镜切换 ie only
<style type="text/css">
.img{ width:328px !important;width:330px; height:240px; border:1px solid #666666; border-bottom:none}
.bottom{ height:31px; width:328px !important;width:330px; border:1px solid #666666; border-top:none; background-image: url(http://album.hi.csdn.net/app_uploads/wtcsy/20081212/174251431.t.gif) }
.information{ height:31px; width:220px; float:left; font-size:14px; text-align:center; vertical-align:middle; line-height:31px;}
.div1{ width:13px; height:19px; overflow:hidden; background-image:url(http://album.hi.csdn.net/app_uploads/wtcsy/20081212/174359116.t.gif); float:left; margin-left:25px; margin-top:5px; text-align:center; cursor:pointer}
.div2{ width:13px; height:19px; overflow:hidden; background-image:url(http://album.hi.csdn.net/app_uploads/wtcsy/20081212/174510802.t.gif); float:left; margin-left:14px; margin-top:5px; text-align:center;cursor:pointer}
.div3{ width:13px; height:19px; overflow:hidden; background-image:url(http://album.hi.csdn.net/app_uploads/wtcsy/20081212/174510802.t.gif); float:left; margin-left:14px; margin-top:5px; text-align:center;cursor:pointer}
</style>
<body>
<div id="ss"></div>
</body>
<script>
function ImgSwitch(id,data,text){
this.obj = document.getElementById(id) //父元素
this.data = data //图片数据源
this.i = 0 //记录现在是哪张图片
this.img = "" //记录img元素
this.div = new Array() //存放3个显示数字的div
this.timer = "" //记录那个定时器的
this.text = text
this.j = 0
this.textdiv = ""
}
ImgSwitch.prototype.Framework=function(){
var self = this
var divimg = document.createElement("div")
divimg.className = "img"
this.obj.appendChild(divimg)
var img = document.createElement("img")
this.img = img
img.style.filter = "revealTrans()";
img.src = this.data[0]
divimg.appendChild(img)
var divbottom = document.createElement("div")
divbottom.className = "bottom"
this.obj.appendChild(divbottom)
var divinformation = document.createElement("div")
divinformation.className = "information"
divinformation.innerHTML = this.text[0]
this.textdiv = divinformation
divbottom.appendChild(divinformation)
var div1 = document.createElement("div")
div1.className = "div1"
div1.innerHTML = 1
div1.onclick=function(){self.Change(0)}
this.div.push(div1)
divbottom.appendChild(div1)
var div2 = document.createElement("div")
div2.className = "div2"
div2.innerHTML = 2
div2.onclick=function(){self.Change(1)}
this.div.push(div2)
divbottom.appendChild(div2)
var div3 = document.createElement("div")
div3.className = "div3"
div3.innerHTML = 3
div3.onclick=function(){self.Change(2)}
this.div.push(div3)
divbottom.appendChild(div3)
this.timer=setTimeout(function(){self.Switch()},3000)
}
ImgSwitch.prototype.Switch=function(){
var self = this
this.i++
this.j++
if(this.i==this.data.length) {this.i=0;this.j=0}
this.img.filters.revealTrans.Transition=Math.floor(Math.random()*23)
this.img.filters.revealTrans.apply();
this.img.filters.revealTrans.play();
this.img.src = this.data[this.i]
for(var j=0;j<this.div.length;j++)
{this.div[j].style.backgroundImage="url(http://album.hi.csdn.net/app_uploads/wtcsy/20081212/174510802.t.gif)"}
this.textdiv.innerHTML = this.text[this.j]
this.div[this.i].style.backgroundImage="url(http://album.hi.csdn.net/app_uploads/wtcsy/20081212/174359116.t.gif)"
this.timer=setTimeout(function(){self.Switch()},4000)
}
ImgSwitch.prototype.Change=function(num){
var self = this
clearTimeout(this.timer)
for(var j=0;j<this.div.length;j++)
{this.div[j].style.backgroundImage="url(http://album.hi.csdn.net/app_uploads/wtcsy/20081212/174510802.t.gif)"}
this.div[num].style.backgroundImage="url(http://album.hi.csdn.net/app_uploads/wtcsy/20081212/174359116.t.gif)"
this.textdiv.innerHTML=this.text[num]
this.i=num;this.j=num
this.img.filters.revealTrans.Transition=23
this.img.filters.revealTrans.apply();
this.img.filters.revealTrans.play();
this.img.src = this.data[this.i]
this.timer=setTimeout(function(){self.Switch()},3000)
}
var text=["关之琳穿花裙高调亮相美女老了","《嫂嫂19岁》垃圾片,抵制韩片","《剑蝶》迟到引不满,笨蛋呀"]
var data = ["http://album.hi.csdn.net/app_uploads/wtcsy/20081212/173755501.p.jpg","http://album.hi.csdn.net/app_uploads/wtcsy/20081212/174009419.p.jpg","http://album.hi.csdn.net/app_uploads/wtcsy/20081212/174203244.p.jpg"]
var oo = new ImgSwitch("ss",data,text)
oo.Framework()
</script>
<style type="text/css">
.img{ width:328px !important;width:330px; height:240px; border:1px solid #666666; border-bottom:none}
.bottom{ height:31px; width:328px !important;width:330px; border:1px solid #666666; border-top:none; background-image: url(http://album.hi.csdn.net/app_uploads/wtcsy/20081212/174251431.t.gif) }
.information{ height:31px; width:220px; float:left; font-size:14px; text-align:center; vertical-align:middle; line-height:31px;}
.div1{ width:13px; height:19px; overflow:hidden; background-image:url(http://album.hi.csdn.net/app_uploads/wtcsy/20081212/174359116.t.gif); float:left; margin-left:25px; margin-top:5px; text-align:center; cursor:pointer}
.div2{ width:13px; height:19px; overflow:hidden; background-image:url(http://album.hi.csdn.net/app_uploads/wtcsy/20081212/174510802.t.gif); float:left; margin-left:14px; margin-top:5px; text-align:center;cursor:pointer}
.div3{ width:13px; height:19px; overflow:hidden; background-image:url(http://album.hi.csdn.net/app_uploads/wtcsy/20081212/174510802.t.gif); float:left; margin-left:14px; margin-top:5px; text-align:center;cursor:pointer}
</style>
<body>
<div id="ss"></div>
</body>
<script>
function ImgSwitch(id,data,text){
this.obj = document.getElementById(id) //父元素
this.data = data //图片数据源
this.i = 0 //记录现在是哪张图片
this.img = "" //记录img元素
this.div = new Array() //存放3个显示数字的div
this.timer = "" //记录那个定时器的
this.text = text
this.j = 0
this.textdiv = ""
}
ImgSwitch.prototype.Framework=function(){
var self = this
var divimg = document.createElement("div")
divimg.className = "img"
this.obj.appendChild(divimg)
var img = document.createElement("img")
this.img = img
img.style.filter = "revealTrans()";
img.src = this.data[0]
divimg.appendChild(img)
var divbottom = document.createElement("div")
divbottom.className = "bottom"
this.obj.appendChild(divbottom)
var divinformation = document.createElement("div")
divinformation.className = "information"
divinformation.innerHTML = this.text[0]
this.textdiv = divinformation
divbottom.appendChild(divinformation)
var div1 = document.createElement("div")
div1.className = "div1"
div1.innerHTML = 1
div1.onclick=function(){self.Change(0)}
this.div.push(div1)
divbottom.appendChild(div1)
var div2 = document.createElement("div")
div2.className = "div2"
div2.innerHTML = 2
div2.onclick=function(){self.Change(1)}
this.div.push(div2)
divbottom.appendChild(div2)
var div3 = document.createElement("div")
div3.className = "div3"
div3.innerHTML = 3
div3.onclick=function(){self.Change(2)}
this.div.push(div3)
divbottom.appendChild(div3)
this.timer=setTimeout(function(){self.Switch()},3000)
}
ImgSwitch.prototype.Switch=function(){
var self = this
this.i++
this.j++
if(this.i==this.data.length) {this.i=0;this.j=0}
this.img.filters.revealTrans.Transition=Math.floor(Math.random()*23)
this.img.filters.revealTrans.apply();
this.img.filters.revealTrans.play();
this.img.src = this.data[this.i]
for(var j=0;j<this.div.length;j++)
{this.div[j].style.backgroundImage="url(http://album.hi.csdn.net/app_uploads/wtcsy/20081212/174510802.t.gif)"}
this.textdiv.innerHTML = this.text[this.j]
this.div[this.i].style.backgroundImage="url(http://album.hi.csdn.net/app_uploads/wtcsy/20081212/174359116.t.gif)"
this.timer=setTimeout(function(){self.Switch()},4000)
}
ImgSwitch.prototype.Change=function(num){
var self = this
clearTimeout(this.timer)
for(var j=0;j<this.div.length;j++)
{this.div[j].style.backgroundImage="url(http://album.hi.csdn.net/app_uploads/wtcsy/20081212/174510802.t.gif)"}
this.div[num].style.backgroundImage="url(http://album.hi.csdn.net/app_uploads/wtcsy/20081212/174359116.t.gif)"
this.textdiv.innerHTML=this.text[num]
this.i=num;this.j=num
this.img.filters.revealTrans.Transition=23
this.img.filters.revealTrans.apply();
this.img.filters.revealTrans.play();
this.img.src = this.data[this.i]
this.timer=setTimeout(function(){self.Switch()},3000)
}
var text=["关之琳穿花裙高调亮相美女老了","《嫂嫂19岁》垃圾片,抵制韩片","《剑蝶》迟到引不满,笨蛋呀"]
var data = ["http://album.hi.csdn.net/app_uploads/wtcsy/20081212/173755501.p.jpg","http://album.hi.csdn.net/app_uploads/wtcsy/20081212/174009419.p.jpg","http://album.hi.csdn.net/app_uploads/wtcsy/20081212/174203244.p.jpg"]
var oo = new ImgSwitch("ss",data,text)
oo.Framework()
</script>
解决方案 »
- JS如何判断本地客户端是否安装outlook
- 我下载了一个jquery-1.5.min.js怎么用啊
- 不唐突的javascript事件绑定问题
- 函数返回值问题
- 请问VML画图的position:relative和position:absolute有什么区别,谢谢
- (100分) xtree树中的js代码是怎么调的,点击次数多的时候cookie为什么会丢失,导致session丢失??
- 如何在一个iframe中显示一个有样式的文本内容?
- JavaScript变量问题,请各位大侠帮忙
- javascript 下拉菜单从数据库去数据显示在另一个下拉菜单或文本框中(急)
- 取不到include进的页面的值,请教诸位
- ★★★★★★★★★★★★★★★这两个怎么不一样???★★★★★★★★★★★★★★★
- 请教这句话,多谢
<body onload="show()"><SCRIPT>
var widths=256;
var heights=256;
var counts=5;
img1=new Image ();
img1.src='bei bei_256x256.png';
img2=new Image ();
img2.src='jing jing_256x256.png';
img3=new Image ();
img3.src='huan huan_256x256.png';
img4=new Image ();
img4.src='ying ying_256x256.png';
img5=new Image ();
img5.src='nini_256x256.png';
url1=new Image ();
url1.src='http://www.baidu.com';
url2=new Image ();
url2.src='http://www.baidu.com';
url3=new Image ();
url3.src='http://www.baidu.com';
url4=new Image ();
url4.src='http://www.baidu.com';
url5=new Image ();
url5.src='http://www.baidu.com';
function show(){
alert("show");
change_img();
}
var nn=1;
var key=0;
function change_img()
{
if(key==0){
key=1;
}
else if(document.all)
{
document.getElementById("pic").filters[0].Apply();
document.getElementById("pic").filters[0].Play(duration=2);
}
eval('document.getElementById("pic").src=img'+nn+'.src');
eval('document.getElementById("url").href=url'+nn+'.src');
for (var i=1;i<=counts;i++){
document.getElementById("xxjdjj"+i).className='axx';
}
document.getElementById("xxjdjj"+nn).className='bxx';
nn++;
if(nn>counts)
{
nn=1;
}
tt=setTimeout('change_img()',4000);
}
function changeimg(n){nn=n;window.clearInterval(tt);change_img();}
document.write('<style>');
document.write('.axx{padding:1px 7px;border-left:#cccccc 1px solid;}');
document.write('a.axx:link,a.axx:visited{text-decoration:none;color:#fff;line-height:12px;font:9px sans-serif;background-color:#666;}');
document.write('a.axx:active,a.axx:hover{text-decoration:none;color:#fff;line-height:12px;font:9px sans-serif;background-color:#999;}');
document.write('.bxx{padding:1px 7px;border-left:#cccccc 1px solid;}');
document.write('a.bxx:link,a.bxx:visited{text-decoration:none;color:#fff;line-height:12px;font:9px sans-serif;background-color:#D34600;}');
document.write('a.bxx:active,a.bxx:hover{text-decoration:none;color:#fff;line-height:12px;font:9px sans-serif;background-color:#D34600;}');
document.write('</style>');
document.write('<div style="width:'+widths+'px;height:'+heights+'px;overflow:hidden;text-overflow:clip;">');
document.write('<div><a id="url"><img id="pic" style="border:0px;filter:progid:dximagetransform.microsoft.wipe(gradientsize=1.0,wipestyle=4, motion=forward)" width='+widths+' height='+heights+' /></a></div>');
document.write('<div style="filter:alpha(style=1,opacity=10,finishOpacity=80);background: #888888;width:100%-2px;text-align:right;top:-12px;position:relative;margin:1px;height:12px;padding:0px;margin:0px;border:0px;">');
for(var i=1;i<counts+1;i++){document.write('<a href="javascript:changeimg('+i+');" id="xxjdjj'+i+'" class="axx" target="_self">'+i+'</a>');}
document.write('</div></div>');</SCRIPT>
</body>
</html>
http://www.itgoto.com.cn/sablog-x/?action=show&id=90
里面有调试好的源代码下载哦.
仿msn轮换广告,附带缩略图的JS图片轮换代码写的很详细的,你对照看一下就明白了