非常简洁的js图片轮播

<div id="tupian"></div>
<script>
var jpg =new Array();
jpg[0]="url(c.jpg)";
jpg[1]="url(d.jpg)";
jpg[2]="url(x.jpg)";
jpg[3]="url(z.jpg)";
var tjimg = document.getElementById("tupian");
var xb=0;
function lunbo()
{xb++;
if(xb == jpg.length)
{
xb=0;
}
tjimg.style.backgroundImage=jpg[xb];
window.setTimeout("lunbo()",2000); //实现无限循环图片,即轮播效果
}
window.setTimeout("lunbo()",2000);//调用函数/方法
</script>

时间: 2024-11-10 13:15:16

非常简洁的js图片轮播的相关文章

js图片轮播与索引变色

<!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-

js 图片轮播(一)

<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <title>图片轮播(一)</title> <style> *{margin:0; padding:0;} .div1{position:relative;height:100%;} .div1 img{width:100%; position:relative

JS图片轮播

轮播就是一组图,每次显示一张1. 先定义两个函数:显示某图,隐藏某图2. 写自动轮播3. 写点击按钮的图片切换 <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Carousel·轮播</title> <style> div.outer { width: 200px; height: 200px; border: 1px solid

js图片轮播图

/*焦点图*/        var Box='.carousel';//盒子        var Menu=$(Box+' .l_cursor li');//圆点菜单        var Con=$(Box+' .carouselChange li');//大图        var Text=$(Box+' .text li');//图注文字        var Prev=$(Box+' .Prev');//上一页        var Next=$(Box+' .next');//下

简洁原生js实现轮播图

html: <div class="comiis_wrapad" id="slideContainer"> <div id="frameHlicAe" class="frame cl"> <div class="temp"></div> <div class="block"> <div class="cl&quo

angular js 图片轮播

搬运工: eg1: Build a Sweet AngularJS Photo Slider Pt 2 with ngTouch DEMO:http://paul-xiao.github.io/angular-photo-slider/ eg2: 使用原生AngularJs模拟京东首页轮播图(不依靠任何外部插件) 暂时还没搞清楚,先学习学习文档再说

实用的原生js图片轮播

<!DOCTYPE html><html> <head>    <meta charset="UTF-8">    <title></title>    <style type="text/css">        * {            margin: 0;            padding: 0;            text-decoration: none;   

最简单的JS图片轮播

var arr=new Array(); arr[1]="";//放图片地址 arr[2]=""; arr[3]=""; var no=0; setInterval(fn,2000); //2秒换一次图片  function fn(){    idsrc=document.getElementById("id");    if(num==arr.length-1)         no=0;    else         n

js 图片轮播

http://jingyan.baidu.com/article/e3c78d646afd933c4c85f5ac.html(测试过) http://sc.chinaz.com/jiaoben/161028496650.htm http://sc.chinaz.com/jiaoben/160524061300.htm#down(测试过) http://jingyan.baidu.com/article/5d6edee2ef48c599eadeecc8.html http://www.jb51.n