<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>生成轮播图片</title>
</head>
<body>
    <div style="width:287px; height:248px; border:solid 1px #cecece;background:#F3F3F3; padding:6px; ">
<script language="javascript" type="text/javascript">
    var widths = 600;   //宽              
    var heights = 600;   //高              
    var counts = 3; //显示的数量
    img1 = new Image(); img1.src = '../images/slide-01.jpg'; //图片地址
    img2 = new Image(); img2.src = '../images/slide-02.jpg';
    img3 = new Image(); img3.src = '../images/slide-03.jpg';    
    url1 = new Image(); url1.src = 'http://URL?action-viewnews-itemid-2439'; //图片链接的URL
    url2 = new Image(); url2.src = 'http://URL/?action-viewnews-itemid-2386-page-1';
    url3 = new Image(); url3.src = 'http://URL/?action-viewnews-itemid-2384-page-4';
 
    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()', 2000);
    }
    function changeimg(n) { nn = n; window.clearInterval(tt); change_img(); }

document.write('<style>');
    document.write('.axx{padding:1px 7px;border-left:#ffffff 1px solid;font-weight: bold;}');
    document.write('a.axx:link,a.axx:visited{text-decoration:none;color:#fff;line-height:14px;font:11px sans-serif;font-weight: bold;}');
    document.write('a.axx:active,a.axx:hover{text-decoration:none;color:#fff;line-height:14px;font:11px sans-serif;font-weight: bold;}');
    document.write('.bxx{padding:1px 7px;border-left:#ffffff 1px solid;font-weight: bold;}');
    document.write('a.bxx:link,a.bxx:visited{text-decoration:none;color:#fff;line-height:14px;font:11px sans-serif;font-weight: bold;}');
    document.write('a.bxx:active,a.bxx:hover{text-decoration:none;color:#fff;line-height:14px;font:11px sans-serif;background-color:#ff0000;font-weight: bold;}');
    document.write('</style>');
    document.write('<div style="width:' + widths + 'px;height:' + heights + 'px;overflow:hidden;text-overflow:clip;">');
    document.write('<div><a id="url" target="_blank"><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: #000000;width:100%-2px;text-align:right;top:-14px;position:relative;margin:1px;height:20px;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>
</div>

</body>
</html>

原文转载:http://jilo88.iteye.com/blog/702619

javascript 生成页面轮播元素的更多相关文章

  1. 帮助快速生成页面固定显示元素的jQuery插件 - sticky-kit

    来源:GBin1.com 如果需要在用户滚动页面的时候,保持特定元素始终可见的话,今天这里我们介绍的Sticky-Kit是一个不错的选择. 它是一个开源的jQuery插件,可以帮助大家快速针对页面元素 ...

  2. javascript原生js轮播图

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

  3. JavaScript实现动态轮播图效果

    功能描述: 1.鼠标经过 左右侧箭头显示,鼠标离开 箭头隐藏 2.动态添加底部小圆圈并绑定单击事件,并且让小圆圈的点击事件和左右箭头点击事件同步 3.拷贝第一张图片添加到ul最后可以实现动态添加图片 ...

  4. JavaScript实现图片轮播组件

    效果: 自动循环播放图片,下方有按钮可以切换到对应图片. 添加一个动画来实现图片切换. 鼠标停在图片上时,轮播停止,出现左右两个箭头,点击可以切换图片. 鼠标移开图片区域时,从当前位置继续轮播. 提供 ...

  5. swiper轮播问题之一:轮播图内容为动态数据生成时轮播图无法自动轮播

    本人在用H5做移动端项目中使用Swiper遇到的两个问题,因此加深了对Swiper的掌握,分享出来对刚开始接触Swiper的童鞋们或多或少会有帮助.        首先,new Swiper的初始化最 ...

  6. 用JavaScript制作banner轮播图

    JavaScript_banner轮播图 让我们一起来学习一下用js怎么实现banner轮播图呢? 直接看代码: <!DOCTYPE html> <html> <head ...

  7. JavaScript实现简单轮播图动画

    运行效果: 源代码: <!DOCTYPE html> <html lang="zh"> <head> <meta charset=&quo ...

  8. html+css+javascript实现简易轮播图片

    html: <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <lin ...

  9. 用html +js+css 实现页面轮播图效果

    html 页面 <html lang="en"> <head> <meta charset="UTF-8"> <met ...

随机推荐

  1. C#DB2开发问题随记

    最近公司有个小工具需要用到DB2数据库,以前没玩过DB2,觉得应该很容易就实现了. 这个小工具最开始用了Nhibernate来连接DB2,Nhibernate也是第一次用..实在是惭愧啊... 第一次 ...

  2. php中0,空,null和false的区别

    <? $str1 = null; $str2 = false; echo $str1==$str2 ? ‘相等’ : ‘不相等’; $str3 = ""; $str4 = 0 ...

  3. Centos rpm缺少依赖无法安装mysql5.5

    rpm -ivh mysql-5.5.22-2.1.i386.rpm --nodeps --force 缺少依赖导致rpm -ivh mysql-5.5.22-2.1.i386.rpm命令无法安装!

  4. 关于Python的self指向性

    Python的self是指向类的实例化对像,而不是类本身,每次调用类的实例化即self指向此实例化对像,如下代码: class Person: def __init__(self,name): sel ...

  5. React使用笔记1-React的JSX和Style

    React使用笔记1-React的JSX和Style Date: 2015-11-27 20:56 Category: Web Tags: JavaScript Author: 刘理想 [toc] 1 ...

  6. C#)Windows Shell 编程系列5 - 获取图标

    原文 C#)Windows Shell 编程系列5 - 获取图标 (本系列文章由柠檬的(lc_mtt)原创,转载请注明出处,谢谢-) 接上一节:(C#)Windows Shell 编程系列4 - 上下 ...

  7. USACO 2001 OPEN

    第1题 绿组. 奶牛接力赛[relay] 题目描述 农夫约翰已经为一次赛跑选出了K(2≤K≤40)头牛组成了一支接力队.赛跑在农夫约翰所拥有的农场上进行,农场的编号为1到Ⅳf4≤Ⅳ< 800), ...

  8. Hope

    透过希望的窗棂,在阴霾的罅隙里也可以寻找阳光,看到未来的春暖花开. ——forever97

  9. 如何用python抓取js生成的数据 - SegmentFault

    如何用python抓取js生成的数据 - SegmentFault 如何用python抓取js生成的数据 1赞 踩 收藏 想写一个爬虫,但是需要抓去的的数据是js生成的,在源代码里看不到,要怎么才能抓 ...

  10. 对象图(Object Diagram)—UML图(三)

    一.用一张图来介绍一下对象图的基本内容 二.对象图与类图的基本差别 三.对象图实例