网页上动态图片代码,急,求大神。。追加分!

野鼻孔 2013-03-20 02:34:00
大神们好,想做个类似大的网站,图片滚动形式,代码如下

<script type="text/javascript" src="focusflash.js">
<!--

var focus_width = 996; // 图片宽度
var focus_height= 400; // 图片高度
var text_height = 20; // 显示的文字高度
var swf_height = focus_height + text_height;

var pics ="image/21.jpg|image/21.jpg";
var links="image/21.jpg|image/21.jpg";
var texts="image/21.jpg|image/21.jpg";

document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" ');
document.write('codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" ');
document.write('width="'+ focus_width +'" ');
document.write('height="'+ swf_height +'">');
document.write('<param name="allowScriptAccess" value="sameDomain">');
document.write('<param name="movie" value="focus.swf">');
document.write('<param name="quality" value="high">');
document.write('<param name="bgcolor" value="#ffffff">');
document.write('<param name="menu" value="false">');
document.write('<param name=wmode value="opaque">');
document.write('<param name="FlashVars" ');
document.write('value="pics='+pics);
document.write( '&links='+links);
document.write( '&texts='+texts);
document.write( '&borderwidth='+focus_width);
document.write( '&borderheight='+focus_height);
document.write( '&textheight='+text_height+'">');
document.write('<embed src="focus.swf" ');
document.write('wmode="opaque" ');
document.write('FlashVars="pics='+pics);
document.write( '&links='+links);
document.write( '&texts='+texts);
document.write( '&borderwidth='+focus_width);
document.write( '&borderheight='+focus_height);
document.write( '&textheight='+text_height+'" ');
document.write('menu="false" ');
document.write('bgcolor="#ffffff" ');
document.write('quality="high" ');
document.write('width="'+ focus_width +'" ');
document.write('height="'+ focus_height +'" ');
document.write('allowScriptAccess="sameDomain" ');
document.write('type="application/x-shockwave-flash" ');
document.write('pluginspage="http://www.macromedia.com/go/getflashplayer" />');
document.write('</object>');

//-->
</script>


代码链接如下 http://www.cnblogs.com/zhuyiwen/archive/2006/06/07/420119.html

我下载了个,但是不知道怎么用,求大神详解。。
...全文
213 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
functionsub 2013-03-20
  • 打赏
  • 举报
回复
下载focus.swf,放到一个目录下, 把代码放到html文件里, 更改document.write('<embed src="focus.swf" ');定位到你刚下载的swf文件路径 再修改上面那些参数就可以了。 var pics ="image/21.jpg|image/21.jpg"; var links="image/21.jpg|image/21.jpg"; var texts="image/21.jpg|image/21.jpg"; pics是图片的列表,用|分割, links是图片连接的列表,用|分割, texts是说明文字的类表,用|分割。 再修改 var focus_width = 996; // 图片宽度 var focus_height= 400; // 图片高度 var text_height = 20; // 显示的文字高度 var swf_height = focus_height + text_height; 调整到你想要的合适的尺寸。
heshengyuboy 2013-03-20
  • 打赏
  • 举报
回复
给你个我写的代码jquery+div实现的滚动,html5+css3的标准ie的显示不是很好你可以改改

<html>
<head>
     
<style>
    div{
        cursor: pointer;
        font-size:10pt;
        }
             
.pb{
    width:300px;/*单个图片的宽(和显示区域相同)*/
    height:300px;/*单个图片的高(和显示区域相同)*/
    }
    #plist{
        position:relative;
        top:-29px;
        }
    #pshow{
    width:300px;/*显示区域的宽度*/
    height:300px;/*显示区域的高度*/
    overflow: hidden;
    position:absolute;
    top:20px;
    left:20px;
        }
</style>
<script src="jquery-1.9.1.js" type="text/javascript"></script>
<script>
    var i=1;
    function pchange(obj){
        var imgtop=((0-(obj-1))*300-29)+"px";
        $("#plist").animate({
        top:imgtop
},"slow");
  i=obj++;
  if(i>4){
        i=1;
        }
        }
 
function timechange(){
    pchange(i);
    i++;
    if(i>4){
        i=1;
        }
        setTimeout('timechange()',3000);
    }
</script>
</head>
 
<body onload="timechange()">
<div id="pshow">
    <div style="display:table;position:relative;left:150px;top:260px;z-index:99;">
    <div style="display:table-cell;width:25px;height:20px;background:#EEEE00;text-align:center;" onmouseover="pchange(1)">1</div>
    <div style="display:table-cell;width:10px;height:20px;"></div>
    <div style="display:table-cell;width:25px;height:20px;background:#EEEE00;text-align:center;" onmouseover="pchange(2)">2</div>
    <div style="display:table-cell;width:10px;height:20px;"></div>
    <div style="display:table-cell;width:25px;height:20px;background:#EEEE00;text-align:center;" onmouseover="pchange(3)">3</div>
    <div style="display:table-cell;width:10px;height:20px;"></div>
    <div style="display:table-cell;width:25px;height:20px;background:#EEEE00;text-align:center;" onmouseover="pchange(4)">4</div>
    </div>
    <div id="plist">
        <div class="pb" style="background:green;">
             
            </div>
                    <div  class="pb" style="background:red;">
             
            </div>
                    <div class="pb" style="background:blue;">
             
            </div>
                    <div  class="pb" style="background:yellow;">
             
            </div>
        </div>
         
</div>
 
</body>
</html>

87,926

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧