<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. margin 属性的相关问题

    1.margin 的IE6 双边距问题 问题描述:浮动的块挨边框的时候会产生双倍的边距 解决方案: 1.增加display:inline; 2.去除float属性 2.margin 的重叠问题 CSS ...

  2. Problem E: Product

    Problem E: ProductTime Limit: 1 Sec Memory Limit: 128 MBSubmit: 18 Solved: 14[Submit][Status][Web Bo ...

  3. bzoj 4373: 算术天才⑨与等差数列 hash

    题目链接 题目大意:  给你n个数, 给两种操作, 一种给你l, r, k,问你[l, r]区间里的数排序后能否构成一个公差为k的等差数列. 另一种是将位置x的数变为y. 强制在线. 可以用hash来 ...

  4. Git使用方法记录(一)

    记录下git的基本使用方法,这里是以ubuntu14.04为例. 1,使用前的初始设置 git config –global user.name “FirstName LastName” git co ...

  5. https tomcat 证书搭建

    首先生成证书说明 keytool -genkey -alias castest -keyalg RSA -keystore c:/keys/caskey 先让输入密码,密码必须记住,下面会用到 其中“ ...

  6. 10-C语言函数

    目录: 一.函数 二.return与exit关键字 三.递归与递推 回到顶部 一.函数 1 函数由函数名.返回值.形参.函数体组成. 函数的使用分三个步骤:声明.定义.调用 2 语法格式: 返回值类型 ...

  7. BootStrap 轮播 Carousel

    参考 http://wrongwaycn.github.io/bootstrap/docs/javascript.html#collapse 同样 启动方式有2种 一种是在div的class中加  另 ...

  8. ***EF中的问题(复习的同学可略过)

    1.当类中出现两个导航属性时,需使用额外代码说明类之间的关系. [ForeignKey("Id")] [InverseProperty("Id"]

  9. CI 模板解析器类

    模板解析器类可以解析你的视图文件中的伪变量.它可以解析简单的变量或者以变量作为标签的结构.如果你以前没有用过模板引擎,那么伪变量如下所示: <html><head><ti ...

  10. HDU 1851 A Simple Game

    典型的尼姆博弈,在n对石子中,告诉你每堆的数目和每次从该堆最多可以取的数目,求最终谁将其取完. 题解:SG(i)=mi%(li+1),求异或值即可. #include <cstdio> i ...