javascript 生成页面轮播元素
<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 生成页面轮播元素的更多相关文章
- 帮助快速生成页面固定显示元素的jQuery插件 - sticky-kit
来源:GBin1.com 如果需要在用户滚动页面的时候,保持特定元素始终可见的话,今天这里我们介绍的Sticky-Kit是一个不错的选择. 它是一个开源的jQuery插件,可以帮助大家快速针对页面元素 ...
- javascript原生js轮播图
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...
- JavaScript实现动态轮播图效果
功能描述: 1.鼠标经过 左右侧箭头显示,鼠标离开 箭头隐藏 2.动态添加底部小圆圈并绑定单击事件,并且让小圆圈的点击事件和左右箭头点击事件同步 3.拷贝第一张图片添加到ul最后可以实现动态添加图片 ...
- JavaScript实现图片轮播组件
效果: 自动循环播放图片,下方有按钮可以切换到对应图片. 添加一个动画来实现图片切换. 鼠标停在图片上时,轮播停止,出现左右两个箭头,点击可以切换图片. 鼠标移开图片区域时,从当前位置继续轮播. 提供 ...
- swiper轮播问题之一:轮播图内容为动态数据生成时轮播图无法自动轮播
本人在用H5做移动端项目中使用Swiper遇到的两个问题,因此加深了对Swiper的掌握,分享出来对刚开始接触Swiper的童鞋们或多或少会有帮助. 首先,new Swiper的初始化最 ...
- 用JavaScript制作banner轮播图
JavaScript_banner轮播图 让我们一起来学习一下用js怎么实现banner轮播图呢? 直接看代码: <!DOCTYPE html> <html> <head ...
- JavaScript实现简单轮播图动画
运行效果: 源代码: <!DOCTYPE html> <html lang="zh"> <head> <meta charset=&quo ...
- html+css+javascript实现简易轮播图片
html: <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <lin ...
- 用html +js+css 实现页面轮播图效果
html 页面 <html lang="en"> <head> <meta charset="UTF-8"> <met ...
随机推荐
- Andy's First Dictionary
Description Andy, 8, has a dream - he wants to produce his very own dictionary. This is not an easy ...
- 关于Staruml与powerdesigner启动使用中的问题
问题描述:启动StarUML时,报System Error.Code:1722.RPC服务器不可用的错误! 如下: 这时候: 只需要开启Print Spooler服务即可!在“控制面板中-->管 ...
- set up blog on github
http://www.ruanyifeng.com/blog/2012/08/blogging_with_jekyll.html
- 捕捉小括号获取的内容保存在RegExp的$1 $2..属性中
~~~~捕捉小括号获取的内容保存在RegExp的$1 $2..属性中 var reg=/^(-?\d+)(px|pt|em|in)?$/;if(reg.test(svalue)){ ...
- 超轻量级PHP SQL数据库框架
<?php /** * ! Medoo 0.8.5 - Copyright 2013, Angel Lai - MIT license - http://medoo.in */ class me ...
- HDU 3625 Examining the Rooms
题目大意:有n个房间,n!个钥匙,在房间中,最多可以破k扇门,然后得到其中的钥匙,去开其它的门,但是第一扇门不可以破开,求可以打开所有门的概率. 题解:首先,建立这样的一个模型,题目相当于给出一个图, ...
- Java发送HTTP POST请求(内容为xml格式)
今天在给平台用户提供http简单接口的时候,顺便写了个调用的Java类供他参考. 服务器地址:http://5.0.217.50:17001/VideoSend 服务器提供的是xml格式的h ...
- python小游戏实现代码
早上逛CSDN首页就见到这么一篇教程.看了一下很有意思,就马上动手实现了一下.看看效果吧: 完整代码: # -*- coding: utf-8 -*- # 1 - Import library imp ...
- 关于js闭包是否真的会造成内存泄漏(转载)
闭包是一个非常强大的特性,但人们对其也有诸多无解.一种危言耸听的说法是闭包会造成内存泄露. 局部变量本来应该在函数退出的时候被解除引用,但如果局部变量被封闭在闭包形成的环境中,那么这个局部变量就能一直 ...
- 初学MVC
学习MVC基础:C#. ADO.NET .html.javascript.ASP.Net .WebFrom MVC模式两种理解:一种是表现模式,另一种是架构模式.它将应用程序分成三个主要的组件:视图( ...