图片轮播

大多数东西都可以用window或者直接用document .(点)出来  JavaScript的语句基本与c#差不多  只有少许区别

 1 /* CSS Document */
 2 #a
 3 {
 4     width:60%;
 5     height:600px;
 6     background-image:url(../%E5%9B%BE%E7%89%87/QQ%E5%9B%BE%E7%89%8720160525205232.jpg;)
 7 }
 8 #b1
 9 {
10     cursor:pointer;
11     width:8%;
12     height:200px;
13     background-image:url(../%E5%9B%BE%E7%89%87/QQ%E6%88%AA%E5%9B%BE20160525205554.png);
14     opacity:0.5;
15     top:275px;
16     left:20%;
17     float:left;
18     position:absolute;
19 }
20 #b2
21 {
22     cursor:pointer;
23     width:8%;
24     height:200px;
25     background-image:url(../%E5%9B%BE%E7%89%87/QQ%E6%88%AA%E5%9B%BE20160525205507.png);
26     opacity:0.5;
27     top:275px;
28     right:20%;
29     float:right;
30     position:absolute;
31 }
 1 <style type="text/css">
 2 *
 3 {
 4     margin:0px auto;
 5     padding:0px;
 6     background-repeat:no-repeat;
 7     background-size:cover;
 8 }
 9 </style>
10 <link href="css-3.css" rel="stylesheet" type="text/css" />
11 </head>
12 
13 <body>
14 <div id="a">
15     <div id="b1" onclick="hanshu2(-1)"></div>
16     <div id="b2" onclick="hanshu2(1)"></div>
17 </div>
18 </body>
19 </html>
20 <script>
21 var a = new Array();
22 a[0]="url(../%E5%9B%BE%E7%89%87/QQ%E5%9B%BE%E7%89%8720160525205232.jpg";
23 a[1]="url(../%E5%9B%BE%E7%89%87/QQ%E5%9B%BE%E7%89%8720160525205224.jpg)";
24 a[2]="url(../%E5%9B%BE%E7%89%87/QQ%E5%9B%BE%E7%89%8720160525205337.jpg)";
25 a[3]="url(../%E5%9B%BE%E7%89%87/QQ%E5%9B%BE%E7%89%8720160525205416.jpg)";
26 a[4]="url(../%E5%9B%BE%E7%89%87/QQ%E5%9B%BE%E7%89%8720160525205059.jpg)";
27 a[5]="url(../%E5%9B%BE%E7%89%87/QQ%E5%9B%BE%E7%89%8720160525205424.jpg)";
28 var b = 0;
29 var c = document.getElementById("a");
30 var d = 0;
31 function hanshu()
32 {
33     if(d==0)
34     {
35         b++;
36         if(b==a.length)
37         {
38             b=0;
39         } 
40         c.style.backgroundImage = a[b];
41         window.setTimeout("hanshu()",1000);
42     }
43 }
44 function hanshu2(x)
45 {
46     d++;
47     if(d==2)
48     {
49         d=0;
50         window.setTimeout("hanshu()",1000);
51     }
52     b += x;
53     if(b==a.length)
54     {
55         b=0;
56     }
57     c.style.backgroundImage = a[b];
58 }
59 window.setTimeout("hanshu()",1000);
60 </script>
原文地址:https://www.cnblogs.com/mazhijie/p/5528663.html