用于显示新闻图片的!

解决方案 »

  1.   


    <HTML>
    <HEAD>
    <TITLE> New Document </TITLE>
    </HEAD>
    <BODY>
    <div align="center"><div id=AdRotator></div>
    </div>
    <SCRIPT LANGUAGE="JavaScript"><!--
    function adRotator() {};
    adRotator.initialize=function(o)
    {
    // script by blueDestinythis._t = new Array();
    this._l = new Array();
    this._p = new Array();
    this._i = new Image();
    this._c = 0;
    this._f = false;
    this._o = o;this._timeout = null;
    this._html = "";// configration.
    // @ image width
    // @ image height
    // @ rotator speed
    // @ filter typethis._w = 450;
    this._h = 450;
    this._s = 4;
    this._x = 23;return this;
    };
    adRotator.add=function(p,t,l) { with (this)
    {
    _p.push(p);
    _t.push(t);
    _l.push(l);
    }};adRotator.load=function() { with (adRotator)
    {
    if( _i.readyState=='complete' )
    {
    if(_p.length-1==_c)
    {
       _f = true;
       _c = 0;
       window.clearTimeout(_timeout);
       //getRef("AdRotator").innerHTML="complete";
       adRotator.play();
    }
    else
    {
       _c++;
       getRef(_o).innerHTML="total images " + _p.length + ", loading picture " + _c + ' ' + _i.readyState + "...";
       _timeout=window.setTimeout(adRotator.load,10)
    }
    }
    else
    {
    getRef(_o).innerHTML="total images " + _p.length + ", loading picture " + _c + ' ' + _i.readyState + "...";
    _timeout=window.setTimeout(adRotator.load,10)
    }
    }};adRotator.play=function() { with (adRotator)
    {
    if( _f )
    {
    _html = "";
    _html += '<table style="border:1px solid #333333;"><tr><td style="font-size:9pt;font-family:tahoma;font-weight:bold;">'
    _html += '<div id="rotatorPlayer"'
       + ' style="width:' + _w + ''
       + ';height:"' + _h + '"'
       + '>'
    _html += '<a href="' + ( _l[_c] ? _l[_c] : "javascript:void(0);" ) + '">';
    _html += '<img id="rotatorPic" src="' + _p[_c] + '"'
       + ' width="' + _w + '"'
       + ' height="' + _h + '"'
       + (_t[_c]?' title="' + _t[_c] + '"':'')
       + ' style="border:1px solid blue;FILTER:revealTrans(transition=' + _x + ',duration=1);"'
       + ' >';
    _html += (_t[_c]?('<div align="center">' + (_c+1) + '. ' + _t[_c] + '</div>'):'<p></p>');
    _html += '</a>';
    _html += "</div>";
    _html += '<div align="right">';for(var i=0; i<_p.length; i++)
    _html += '<span'
         + ' style="border:1px solid #333333;padding:1px 5px 1px 5px;height:10px;text-align:center;cursor:'
         + (_c==i ? ('default;background-color:red;"') : 'hand;" onclick="adRotator.select(' + i + ')"')
         + '>'
         + (i>8?(i+1):('0'+(i+1)))+ '</span> ';_html += "</div></td></tr></table>";
    getRef(_o).innerHTML = _html;getRef("rotatorPic").filters[0].Apply();
    getRef("rotatorPic").filters[0].Play();next();
    }
    else
    {
    _i.src = _p[_c];
    adRotator.load();
    }
    }};
    adRotator.next=function() { with (this)
    {
    (_p.length-1==_c) ? _c=0 : _c++;
    _timeout=window.setTimeout(adRotator.play,_s*1000);
    }};
    adRotator.select=function(i) { with (this)
    {
    window.clearTimeout(_timeout);
    _c=i;
    adRotator.play();
    }};
    adRotator.set=function(second) { with (this)
    {
    window.clearTimeout(_timeout);
    if((/\d+/).test(second)==true)
    {
    _s=second;
    adRotator.play();
    }
    else
    {
    alert("must be digit!")
    adRotator.play();
    }
    }};
    function getRef(id)
    {
    return (document.all?document.all(id):document.getElementById(id));
    }
    adRotator.initialize("AdRotator");adRotator.add("http://img1.qq.com/ent/20060218/3215110.jpg","aa","http://www.7dspace.com")
    adRotator.add("http://img1.qq.com/ent/20060218/3215111.jpg","aa","http://www.7dspace.com")
    adRotator.add("http://img1.qq.com/ent/20060218/3215112.jpg","aa","http://www.7dspace.com")
    adRotator.add("http://img1.qq.com/ent/20060218/3215113.jpg","aa","http://www.7dspace.com")
    adRotator.add("http://img1.qq.com/ent/20060218/3215114.jpg","aa","http://www.7dspace.com")
    adRotator.add("http://img1.qq.com/ent/20060218/3215113.jpg","aa","http://www.7dspace.com")
    adRotator.add("http://img1.qq.com/ent/20060218/3215114.jpg","aa","http://www.7dspace.com")
    adRotator.add("http://img1.qq.com/ent/20060218/3215110.jpg","aa","http://www.7dspace.com")
    adRotator.add("http://img1.qq.com/ent/20060218/3215114.jpg","aa","http://www.7dspace.com")
    adRotator.play();
    //--></SCRIPT></BODY>
    </HTML>
      

  2.   

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <HTML>
    <HEAD>
    <TITLE>JS实现图片幻灯片效果</TITLE>
    <META NAME="Generator" CONTENT="EditPlus">
    <META NAME="Author" CONTENT="">
    <META NAME="Keywords" CONTENT="">
    <META NAME="Description" CONTENT="">
    </HEAD>
    <BODY>
    <div align="center"><div id=AdRotator></div><input id="second"><button onclick="adRotator.set(getRef('second').value)">set time</button></div>
    <SCRIPT LANGUAGE="JavaScript">
    <!--
    function adRotator() {};
    adRotator.initialize=function(o)
    {
    // script by blueDestiny
    this._t = new Array();
    this._l = new Array();
    this._p = new Array();
    this._i = new Image();
    this._c = 0;
    this._f = false;
    this._o = o;
    this._timeout = null;
    this._html = "";
    // configration.
    // @ image width
    // @ image height
    // @ rotator speed
    // @ filter type
    this._w = 450;
    this._h = 450;
    this._s = 4;
    this._x = 23;
    return this;
    };
    adRotator.add=function(p,t,l) { with (this)
    {
    _p.push(p);
    _t.push(t);
    _l.push(l);
    }};
    adRotator.load=function() { with (adRotator)
    {
    if( _i.readyState=='complete' )
    {
    if(_p.length-1==_c)
    {
    _f = true;
    _c = 0;
    window.clearTimeout(_timeout);
    //getRef("AdRotator").innerHTML="complete";
    adRotator.play();
    }
    else
    {
    _c++;
    getRef(_o).innerHTML="total images " + _p.length + ", loading picture " + _c + ' ' + _i.readyState + "...";
    _timeout=window.setTimeout(adRotator.load,10)
    }
    }
    else
    {
    getRef(_o).innerHTML="total images " + _p.length + ", loading picture " + _c + ' ' + _i.readyState + "...";
    _timeout=window.setTimeout(adRotator.load,10)
    }
    }};
    adRotator.play=function() { with (adRotator)
    {
    if( _f )
    {
    _html = "";
    _html += '<table style="border:1px solid #333333;"><tr><td style="font-size:9pt;font-family:tahoma;font-weight:bold;">'
    _html += '<div id="rotatorPlayer"'
    + ' style="width:' + _w + ''
    + ';height:"' + _h + '"'
    + '>'
    _html += '<a href="' + ( _l[_c] ? _l[_c] : "javascript:void(0);" ) + '">';
    _html += '<img id="rotatorPic" src="' + _p[_c] + '"'
    + ' width="' + _w + '"'
    + ' height="' + _h + '"'
    + (_t[_c]?' title="' + _t[_c] + '"':'')
    + ' style="border:1px solid blue;FILTER:revealTrans(transition=' + _x + ',duration=1);"'
    + ' >';
    _html += (_t[_c]?('<div align="center">' + (_c+1) + '. ' + _t[_c] + '</div>'):'<p></p>');
    _html += '</a>';
    _html += "</div>";
    _html += '<div align="right">';
    for(var i=0; i<_p.length; i++)
    _html += '<span'
    + ' style="border:1px solid #333333;padding:1px 5px 1px 5px;height:20px;text-align:center;cursor:'
    + (_c==i ? ('default;background-color:red;"') : 'hand;" onclick="adRotator.select(' + i + ')"')
    + '>'
    + (i>8?(i+1):('0'+(i+1)))+ '</span> ';
    _html += "</div></td></tr></table>";
    getRef(_o).innerHTML = _html;
    getRef("rotatorPic").filters[0].Apply();
    getRef("rotatorPic").filters[0].Play();
    next();
    }
    else
    {
    _i.src = _p[_c];
    adRotator.load();
    }
    }};
    adRotator.next=function() { with (this)
    {
    (_p.length-1==_c) ? _c=0 : _c++;
    _timeout=window.setTimeout(adRotator.play,_s*1000);
    }};
    adRotator.select=function(i) { with (this)
    {
    window.clearTimeout(_timeout);
    _c=i;
    adRotator.play();
    }};
    adRotator.set=function(second) { with (this)
    {
    window.clearTimeout(_timeout);
    if((/\d+/).test(second)==true)
    {
    _s=second;
    adRotator.play();
    }
    else
    {
    alert("must be digit!")
    adRotator.play();
    }
    }};
    function getRef(id)
    {
    return (document.all?document.all(id):document.getElementById(id));
    }
    adRotator.initialize("AdRotator");
    adRotator.add("http://img1.qq.com/ent/20060218/3215110.jpg","aa","http://www.blueidea.com")
    adRotator.add("http://img1.qq.com/ent/20060218/3215111.jpg")
    adRotator.add("http://img1.qq.com/ent/20060218/3215112.jpg")
    adRotator.add("http://img1.qq.com/ent/20060218/3215113.jpg")
    adRotator.add("http://img1.qq.com/ent/20060218/3215114.jpg")
    adRotator.play();
    //-->
    </SCRIPT>
    </BODY>
    </HTML>
      

  3.   

    <!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=gb2312" />
    <title>无标题文档</title>
    </head><body>
    <SCRIPT>
    var widths=282;              
    var heights=164;              
    var counts=6;   
    img1=new Image ();img1.src='http://www.yesky.com/imagelist/2007/018/43rx42mql3ng.jpg'; 
    img2=new Image ();img2.src='http://notebook.yesky.com/imagelist/2007/017/hub8x795v23m.jpg'; 
    img3=new Image ();img3.src='http://www.yesky.com/imagelist/2007/017/dt741w2a2n42.jpg'; 
    img4=new Image ();img4.src='http://www.yesky.com/imagelist/2007/016/hda926w5t574.jpg'; 
    img5=new Image ();img5.src='http://diy.yesky.com/imagelist/2007/010/190g0pqjdbw7.jpg'; 
    img6=new Image ();img6.src='http://www.yesky.com/imagelist/2007/015/67vtz4ew2m5s.jpg'; 
    url1=new Image ();url1.src='http://www.jzxue.com';
    url2=new Image ();url2.src='http://www.jzxue.com';
    url3=new Image ();url3.src='http://www.jzxue.com';
    url4=new Image ();url4.src='http://www.jzxue.com';
    url5=new Image ();url5.src='http://www.jzxue.com';
    url6=new Image ();url6.src='http://www.jzxue.com';
    //天极伊永恒原创
    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>');
    change_img();
    </SCRIPT>
    </body>
    </html>
      

  4.   

     <script type="text/javascript"> 
    // 幻灯片式的网页图片滚动函数(不需要做任何改动)   
    function roll_pic_flash(roll_pic_ary) 
    {   
    // 生成幻灯片式的网页图片滚动代码   
    var w = roll_pic_ary[3][0];   
    var h = roll_pic_ary[3][1];   
    var text_h = roll_pic_ary[3][2];   
    var bgcolor = roll_pic_ary[3][3];   
    var roll_swf = roll_pic_ary[3][4];   
    var swf_height = h + text_h;   
    var pics = roll_pic_ary[0].join("|");   
    var links = roll_pic_ary[1].join("|");   
    var texts = roll_pic_ary[2].join("|");   return '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="'+ w +'" height="'+ swf_height +'"><param name="default_url" value="http://www.hbw.cn/"><param name="allowScriptAccess" value="sameDomain"><param name="movie" value="' + roll_swf + '"><param name="quality" value="high"><param name="bgcolor" value="'+bgcolor+'"><param name="menu" value="false"><param name="improved_by" value="http://www.hbcms.com/"><param name=wmode value="opaque"><param name="FlashVars" value="pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+w+'&borderheight='+h+'&textheight='+text_h+'"><embed src="' + roll_swf + '" wmode="opaque" FlashVars="pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+w+'&borderheight='+h+'&textheight='+text_h+'" menu="false" bgcolor="'+bgcolor+'" quality="high" width="'+ w +'" height="'+ h +'" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object>';   
      
    }   
      
    // 开始设置幻灯片参数   
    var roll_pic_width = 315;                    // 图片宽度   
    var roll_pic_height = 220;                    // 图片高度   
    var roll_text_height = 18;                    // 文字高度   
    var roll_bgcolor = '#FFFFFF';                    // 幻灯片背景色   
    var roll_flash = 'image/roll_pic_new.swf'; // 幻灯片flash地址,请将此flash下载保存到你的服务器,以免失效   
      
    // 幻灯片数组roll_pic_ary初始化(不用做任何改动)   
    var roll_pic_ary = new Array(Array(0),Array(0),Array(0),   
    Array(roll_pic_width,roll_pic_height,roll_text_height,roll_bgcolor,roll_flash));   
      
    // 增加一个图片,连接,文字说明   
    roll_pic_ary[0].push("Admin/Jpg/<%=pics.Tables[0].Rows[0][2].ToString()%>");   
    roll_pic_ary[1].push(escape("http://localhost:1165/News11/NewsDetail.aspx?NewsID=<%=pics.Tables[0].Rows[0][1].ToString() %>"));   
    roll_pic_ary[2].push("<%=pics.Tables[0].Rows[0][3].ToString()%>");   
      
    // 增加一个图片,连接,文字说明   
    roll_pic_ary[0].push("Admin/Jpg/<%=pics.Tables[0].Rows[1][2].ToString()%>");   
    roll_pic_ary[1].push(escape("http://localhost:1165/News11/NewsDetail.aspx?NewsID=<%=pics.Tables[0].Rows[1][1].ToString() %>"));   
    roll_pic_ary[2].push("<%=pics.Tables[0].Rows[1][3].ToString()%>");   
      
    // 增加一个图片,连接,文字说明   
    roll_pic_ary[0].push("Admin/Jpg/<%=pics.Tables[0].Rows[2][2].ToString()%>");   
    roll_pic_ary[1].push(escape("http://localhost:1165/News11/NewsDetail.aspx?NewsID=<%=pics.Tables[0].Rows[2][1].ToString() %>"));   
    roll_pic_ary[2].push("<%=pics.Tables[0].Rows[2][3].ToString()%>");   
      
    // 增加一个图片,连接,文字说明   
    roll_pic_ary[0].push("Admin/Jpg/<%=pics.Tables[0].Rows[3][2].ToString()%>");   
    roll_pic_ary[1].push(escape("http://localhost:1165/News11/NewsDetail.aspx?NewsID=<%=pics.Tables[0].Rows[3][1].ToString() %>"));   
    roll_pic_ary[2].push("<%=pics.Tables[0].Rows[3][3].ToString()%>");   
      
    // 如果还需要增加图片,请copy上面的代码即可  
    //显示幻灯片式的网页图片滚动   
    document.write(roll_pic_flash(roll_pic_ary));   
    </script>