js图片切换代码

<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=gb2312" />
</head>

<body>
<table width="300" height="300" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#f4f4f4">
  <tr>
    <td><script language=网页特效>
var elady_step=3; //1:small, 3:middle, 5:big
var elady_speed=50; //20:fast, 50:middle, 80:slow
var e_tp=new array();
var e_tplink=new array();
var adnum_elady1=0; 
var elady_stop_sh=0;
var elady_star_sh=1;

function elady1_moveimg(){
if ((!document.all&&!document.getelementbyid)||(elady_stop_sh==0)) return;
if (elady_star_sh==1){
 document.all.elady1_divimg.style.pixeltop=parseint(document.all.elady1_divimg.style.pixeltop)+elady_step;}
else if (elady_star_sh==2){
 document.all.elady1_divimg.style.pixelleft=parseint(document.all.elady1_divimg.style.pixelleft)+elady_step;}
else if (elady_star_sh==3){
 document.all.elady1_divimg.style.pixeltop=parseint(document.all.elady1_divimg.style.pixeltop)-elady_step;}
else{
 document.all.elady1_divimg.style.pixelleft=parseint(document.all.elady1_divimg.style.pixelleft)-elady_step;}
if (elady_star_sh<4) elady_star_sh++;
else elady_star_sh=1;
settimeout("elady1_moveimg()",elady_speed);}

e_tplink[0]="http://www.111cn.net/guanggaodaima/";
e_tp[0]="images/01.jpg";

e_tplink[1]="http://www.111cn.net/guanggaodaima/";
e_tp[1]="images/02.jpg";

e_tplink[2]="http://www.111cn.net/guanggaodaima/";
e_tp[2]="images/03.jpg";

e_tplink[3]="http://www.111cn.net/guanggaodaima/";
e_tp[3]="images/04.jpg";
var currentimage=new array();  
for (i=0;i<=3;i++){currentimage[i]=new image();
      currentimage[i].src=e_tp[i];
         }
         function elady1_set(){   if (document.all)
         {      e_tprotator.filters.revealtrans.transition=math.floor(math.random()*23);
               e_tprotator.filters.revealtrans.apply();   }
               }
               function elady1_playco()
               {   if (document.all)      e_tprotator.filters.revealtrans.play()
               }function elady1_nextad(){   if(adnum_elady1<e_tp.length-1)adnum_elady1++ ;
                     else adnum_elady1=0;
                        elady1_set();
                           document.images.e_tprotator.src=e_tp[adnum_elady1];
                              elady1_playco();
                                 thetimer=settimeout("elady1_nextad()", 4000);}
                                 function elady1_linkurl(){   jumpurl=e_tplink[adnum_elady1];
                                    jumptarget='_blank';
                                       if (jumpurl != ''){      if (jumptarget != '')window.open(jumpurl,jumptarget);
                                             else location.href=jumpurl;
                                                }}
function elady1_listmsg()
{   status=e_tplink[adnum_elady1];
document.returnvalue = true;}
document.write("<div id='elady1_divimg' style='position:relative'>");
document.write('<a onmouseo教程ver="elady1_listmsg();return document.returnvalue" href="javascript:elady1_linkurl()" target="_self">');
document.write('<img style="filter: revealtrans(duration=2,transition=20)" height=300 src="javascript:elady1_nextad()" width=300 border=0 name=e_tprotator ></a>');
document.write("</div>");
    </script></td>
  </tr>
</table>
</body>
</html>

代码二
js图片切换特效

<script language="javascript">

var imgurl=new array();

var imglink=new array();

var imgtext=new array();

var picnum=0;

imgurl[1]="图片地址一";

imglink[1]="链接1";

imgtext[1]="标题或简介或其它html内容1";

imgurl[2]="图片地址二";

imglink[2]="链接2";

imgtext[2]="标题或简介或其它html内容2";

imgurl[3]="图片地址三";

imglink[3]="链接3";

imgtext[3]="标题或简介或其它html内容3";

imgurl[4]="图片地址四";

imglink[4]="链接4";

imgtext[4]="标题或简介或其它html内容4";

imgurl[5]="图片地址五";

imglink[5]="链接5";

imgtext[5]="标题或简介或其它html内容5";

function nextpic(){

     if(picnum<4) picnum++ ;//显示4个图片

     else picnum=1;

     if (document.all){

         //下面注意,如果存在于form表单中,需要使用下面的方法,否则可直接使用name。

         document.imginit.filters.revealtrans.transition=math.floor(math.random()*23);

         document.imginit.filters.revealtrans.apply();

         document.imginit.filters.revealtrans.play();

     }

     document.images.imginit.src=imgurl[picnum];

     //如果不是图片,而是swf等,可做判断,内容可在程序中做好,再放于下面。

     focustext.innerhtml='<a href='+imglink[picnum]+' target=_blank>'+imgtext[picnum]+'</a>';

     //设置翻页时间

     thetimer=settimeout('nextpic()', 3000);

}

function gourl(){

     window.open(imglink[picnum],'_blank');

}

</script>

html代码中:

可以做到控件中

<table cellpadding=0 width=100% border=0>

         <tr>

           <td align=middle height="140" >

<div align='center'>

<a href='javascript:gourl()'><img style="filter: revealtrans(duration=2,transition=5)" src="javascript:nextpic()" width="170" height="120" border="1"   id=imginit name=imginit></a></td></tr>

<tr><td align=middle height="38" ><div name=focustext id=focustext align='center'></div>

</div>

</td></tr></table>

代码三

<style type="text/css教程" media="screen">
*{margin:0;padding:0;}
body {
 margin:0;
 padding:0;
 font-size:12px;
 font:12px/1.5em tahoma, verdana, simsun, microsoft yahei, arial unicode ms, mingliu, arial, helvetica;
}
img {
 border:none;
}
ul,li {
 margin:0;
 padding:0;
 list-style:none;
}
.slider {
 position:relative;
 width:748px;
 height:80px;
}
.slider .pic {}
.slider .pic img {
 width:748px;
 height:80px;
}
.slider .num {
 z-index:2;
 position:absolute;
 right:2px;
 bottom:2px;
 width:95px;
 height:16px;
}
.slider .num li {
 float:left;
 display:inline;
 width:16px;
 height:16px;
 line-height:16px;
 margin-left:3px;
 text-align:center;
 color:#595959;
 cursor:pointer;
}
.slider .num li.current {
 background-color:#ffffff;
 font-weight:bold;
 color:#ff4e00;
}
.slider .bg {
 z-index:1;
 position:absolute;
 right:2px;
 bottom:2px;
 width:95px;
 height:16px;
}
.slider .bg li {
 float:left;
 display:inline;
 width:16px;
 height:16px;
 line-height:16px;
 margin-left:3px;
 background-color:#fff;
 filter:alpha(opacity=50);-moz-opacity:0.5;opacity:0.5;background-color:#ffffff;font-size:0;
 text-align:center;
 color:#595959;
 font-size:0;
}
</style>
<a href="<#zc_blog_host#>">站长特效网</a>,站长必备的高质量网页特效和广告代码。111cn.net,站长js特效。<hr>
<!--欢迎来到站长特效网,我们网站收集大量高质量js特效,提供许多广告代码下载,网址:www.111cn.net,zzjs@msn.com,用.net打造靓站-->
<div class="slider" style="height:80px; overflow:hidden">
  <ul class="num" id="homepushname">
    <li id="homead0" class="current">1</li>
    <li id="homead1">2</li>
    <li id="homead2">3</li>
    <li id="homead3">4</li>
    <li id="homead4">5</li>
  </ul>
  <ul class="bg" id="homepushbg">
    <li> </li>
    <li> </li>
    <li> </li>
    <li> </li>
    <li> </li>
  </ul>
  <ul class="pic" id="homepushshow">
<li id="homepushshow1" style="height:80px; overflow:hidden;">
<a href="<#zc_blog_host#>" target="_blank" title="站长特效网,打造国内最帅的网页特效站!"><img src="/ad/1.jpg" onload="return imgzoom(this,600);" onclick="javascript:window.open(this.src);" style="cursor:pointer;"/></a>
</li>
<li id="homepushshow2" style="height:80px; overflow:hidden;">
<a href="http://www.111cn.net" target="_blank" title="站长特效网,打造国内最帅的网页特效站!"><img src="/ad/2.jpg" onload="return imgzoom(this,600);" onclick="javascript:window.open(this.src);" style="cursor:pointer;"/></a>
</li>
<li id="homepushshow3" style="height:80px; overflow:hidden;">
<a href="http://www.111cn.net" target="_blank" title="三号广告图片说明信息"><img src="/ad/3.jpg" onload="return imgzoom(this,600);" onclick="javascript:window.open(this.src);" style="cursor:pointer;"/></a>
</li>
<li id="homepushshow4" style="height:80px; overflow:hidden;">
<a href="http://www.111cn.net" target="_blank" title="四号广告图片说明信息"><img src="/ad/4.jpg" onload="return imgzoom(this,600);" onclick="javascript:window.open(this.src);" style="cursor:pointer;"/></a>
</li>
<li id="homepushshow5" style="height:80px; overflow:hidden;">
<a href="http://www.111cn.net" target="_blank" title="五号广告图片说明信息"><img src="/ad/5.jpg" onload="return imgzoom(this,600);" onclick="javascript:window.open(this.src);" style="cursor:pointer;"/></a>
</li>
</ul>
</div>
<script type="text/javascript">
 var listitem=document.getelementbyid("homepushshow");
 var tlist=document.getelementbyid("homepushname").childnodes;
 var controlitem=[];
 for(var i=0;i<tlist.length;i++){
  if(tlist[i].nodename.tolowercase()=="li"){
   controlitem.push(tlist[i]);
  }
 }
 var piccount=controlitem.length;
 var cid=0;
 var tid=math.floor(math.random()*piccount);
 window.ctop=0
 window.gtop=0;
 window.speed=0;
 window.controlaction="";
 window.timecount=0;
 setinterval(function(){
  if(cid!=tid){
   gtop=tid*80;
   speed=(gtop-ctop)/10;
   cid=tid;
   for(var i=0;i<piccount;i++){
    controlitem[i].classname=((i==cid)?"current":"");
   }
  }
  if(window.ctop!=window.gtop){
   window.ctop+= parseint(speed);
   listitem.style.margintop="-"+ parseint(window.ctop)+"px";
  }
  document.getelementbyid("homepushbg").style.display="block";
  document.getelementbyid("homepushname").style.display="block";
 },20);
//欢迎来到站长特效网,我们的网址是www.111cn.net,很好记,zz站长,js就是js特效,本站收集大量高质量js代码,还有许多广告代码下载。
 for(var i=0;i<piccount;i++){
  controlitem[i].onmouseover=function(){
   var goid=parseint(this.innerhtml)-1;
   cleartimeout(window.controlaction);
   window.controlaction=settimeout(function(){
    tid=goid;
    timecount=0;
   },300);
  }
  controlitem[i].onmouseout=function(){
   cleartimeout(window.controlaction);
  }
 }
//欢迎来到站长特效网,我们的网址是www.111cn.net,很好记,zz站长,js就是js特效,本站收集大量高质量js代码,还有许多广告代码下载。
 setinterval(function(){
  timecount+=1
  if(timecount>=5){
   window.controlaction=settimeout(function(){
    tid=tid+1;
    if(tid>=piccount){tid=0;}
   },20);
   timecount=0;
  }
 },1000);
</script>

时间: 2024-08-14 00:00:32

js图片切换代码的相关文章

带缩略图js图片切换代码

提示:您可以先修改部分代码再运行 梦:牧场小屋 本代码由111cn提供 提示:您可以先修改部分代码再运行

js 图片切换效果代码

<html xmlns="http://www.111cn.net/ 1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>js 图片切换效果代码</title> <script language="javascript教程&quo

js图片切换特效代码

<!doctype html public "-//w3c//dtd html 4.01 transitional//en" "http://www.w3c.org/tr/1999/rec-html401-19991224/loose.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>js图片切换特效代码</titl

js图片切换具体实现代码_javascript技巧

本文实例为大家分享了js实现图片切换的方法,供大家参考,具体内容如下 <html> <head> <meta http-equiv="Content-Type" content="text/html;charset=utf-8"/> <title></title> <style> *{ margin:0; padding:0; } .all{ width:600px; height:350px;

基于jQuery实现仿百度首页换肤背景图片切换代码_jquery

不多说了,先给大家展示效果图,本文支持源码下载哦,需要的朋友可以直接下载使用,代码很简单哦- 在线预览    源码下载 html代码: <a href="#">换肤</a> <div class="heitiao"></div> <div class="con"><img src="images/content.png" /></div> &l

jquery实现图片切换代码_jquery

本文实例为大家分享了jquery实现图片切换的方法,供大家参考,具体内容如下 <html> <head> <meta http-equiv="Content-Type" content="text/html;charset=utf-8"/> <title></title> <script src="http://libs.baidu.com/jquery/2.0.0/jquery.js&qu

js幻灯片切换代码

纯js图片切换幻灯片代码超炫哦

flash as 2.0 实现图片切换代码

这里用as.20制作的一款图片轮换代码哦,不过这里要根mc.mov.loadMovie((((_root.root+"index_roll_")+i)+".jpg"));来实现加载目录的图片名称就OK了. if ((_root.root == "") || (_root.root == undefined)) {  _root.root = ""; } if ((_root.tm == "") || (_r

JS图片切换的具体方法(带缩略图版)_javascript技巧

复制代码 代码如下: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <HTML xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv=&qu