intrun=setInterval(function(){
if(curr_show_img==1){
curr_show_img=0;
obj_img1.style.display='block';
obj_img2.style.display='none';
}else{
    curr_show_img=1;
obj_img1.style.display='none';
obj_img2.style.display='block';
}
},6000);

解决方案 »

  1.   

    <!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="Content-Type" content="text/html; charset=utf-8" />
    <title>无标题文档</title>
    <script type="text/javascript">
    var images=["1.jpg","2.jpg"];
    var o=100;
    var d=-1;
    var k=0;
    function init(){
    var image=document.images[0];
    image.src=images[k%2]+"";
    o+=d;
    image.style.opacity=o/100;
    image.style.filter="alpha(opacity="+o+")";
    window.setTimeout(init,50);
    if(o==0){
    k++;
    d=1;
    }else if(o==100){
    d=-1;
    }
    }
    window.onload=init;
    </script>
    </head><body>
    <img src="" style="width:200px; height:200px" />
    </body>
    </html>
    这样试试
      

  2.   

    嗯好的,除了这样之外能不能用clearInterval来实现呢?
      

  3.   

    intrun=setInterval(function(){//setInterval 每多少时间执行一次,这里是6000毫秒
    if(curr_show_img==1){//如果当前图片1
    curr_show_img=0;//将其设为0
    obj_img1.style.display='block';//img1的display设为块级显示
    obj_img2.style.display='none';//img2隐藏
    }else{
        curr_show_img=1;
    obj_img1.style.display='none';
    obj_img2.style.display='block';
    }
    },6000);不知道是不是这样理解???我觉得应该先隐藏吧
      

  4.   

    <script type="text/javascript">
    (function(){
    try{
    var doc_width=parseInt(document.body.clientWidth);
    var obj_fb=$g('fb_coupon_like');
    var obj_fl=$g('friend_link_cndirect');

    var intrun;
    //var intfade;
    var curr_show_img=1;

    if(obj_fb){
    var gtb_client_width=(doc_width-985)/2-49;
    obj_fb.style.right=gtb_client_width+'px';
    obj_fb.style.display='block';
    }
    if(obj_fl){
    obj_fl.style.right ='0px';
    obj_fl.style.bottom ='0px';
    var flc_hidden=UtilTool.getCookie('flc_hidden');
    if(flc_hidden=='1'){
    obj_fl.style.display='none';
    }else{
    obj_fl.style.display='block';
    var obj_img1=$g('img_cn_panel1');
    var obj_img2=$g('img_cn_panel2');

    intrun=setInterval(function(){
    if(curr_show_img==1){
    curr_show_img=0;
    obj_img1.style.display='block';
    obj_img2.style.display='none';
    }else{
        curr_show_img=1;
    obj_img1.style.display='none';
    obj_img2.style.display='block';
    }
    },6000);  
    }
    }
    }catch(e){}
    })();
    </script>整的代码,然后怎么实现效果,都没思路
      

  5.   

    Jquery教程
    jQuery fadeToggle()http://www.w3schools.com/jquery/jquery_fade.asp#gsc.tab=0