<!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-Type" content="text/html; charset=utf-8" />
<title>我的首页</title>
<style type="text/css">
body{background:url(../picture/sun.jpg)}
*{ padding:0; margin:0; list-style:none; border:0;}
.all{width:500px; height:200px; padding:7px;
border:1px solid #ccc; margin:100px auto; position:relative; }
.screen{width:500px;height:200px; overflow:hidden; position:relative; }
.screen li{ width:500px; height:400px; overflow:hidden; float:left;}
.screen ul{ position:absolute; left:0; top:0px; width:3000px;hight:400px;}
.all ol{ position:absolute; right:10px; bottom:10px; line-height:20px; text-align:center;}
.all ol li{ float:left; width:40px; height:20px; background:#fff; border:1px solid #ccc; margin-left:10px; cursor:pointer;}
.all ol li.current{ background:yellow;}
#arr {display: none;}
#arr span{ width:40px; height:40px; position:absolute; left:5px; top:50%; margin-top:-20px; background:#000; cursor:pointer; line-height:40px; text-align:center; font-weight:bold; font-family:'黑体'; font-size:30px; color:#fff; opacity:0.3; border:1px solid #fff;}
#arr #right{right:5px; left:auto;}
</style>
<script>
window.onload = function () {
var screen = document.getElementById("screen");
var ul = screen.children[0];
var ol = screen.children[1];
var div = screen.children[2];
var imgWidth = screen.offsetWidth;
var tempLi = ul.children[0].cloneNode(true);
ul.appendChild(tempLi);
for(var i = 0; i < ul.children.length - 1; i++) {
var newOlLi = document.createElement("li");
newOlLi.innerHTML = i + 1;
ol.appendChild(newOlLi);}
var olLiArr = ol.children;
olLiArr[0].className = "current";
for(var i = 0, len = olLiArr.length; i < len; i++) {
olLiArr[i].index = i;
olLiArr[i].onmouseover = function (ev) {
for(var j = 0; j < len; j++) {
olLiArr[j].className = ""; }
this.className = "current";
key = square = this.index;
animate(ul, -this.index * imgWidth);}}
var key = 0;
var square = 0;
var timer = setInterval(autoPlay, 3000);
screen.onmouseover = function (ev) {
clearInterval(timer);
div.style.display = "block";}
screen.onmouseout = function (ev) {
timer = setInterval(autoPlay, 3000);
div.style.display = "none";}
var divArr = div.children;
divArr[0].onclick = function (ev) {
key--;
if(key < 0) {
ul.style.left = -(ul.children.length-1) * imgWidth + "px"; key = 4; }
animate(ul, -key * imgWidth);
square--;
if(square < 0) {
square = 4;}
for(var k = 0; k < len; k++) {
olLiArr[k].className = "";}
olLiArr[square].className = "current";}
divArr[1].onclick = autoPlay;
function autoPlay() {
key++;
if(key > ul.children.length - 1) {
ul.style.left = 0;
key = 1;}
animate(ul, -key * imgWidth);
square++;
if(square > 4) { square = 0; }
for(var k = 0; k < len; k++) { olLiArr[k].className = ""; } olLiArr[square].className = "current";}
function animate(ele,target){clearInterval(ele.timer); var speed = target>ele.offsetLeft?10:-10;
ele.timer = setInterval(function () {var val = target - ele.offsetLeft; ele.style.left = ele.offsetLeft + speed + "px"; if(Math.abs(val)<Math.abs(speed)){ele.style.left = target + "px"; clearInterval(ele.timer); }},10) }}
</script>
</head>
<h1 align="center">我们生如夏花,灿如朝阳</h1>
<body>
<div class="all" id='all'> <div class="screen" id="screen">
<ul id="ul">
<li><img src="../picture/6.jpg" width="500" height=200px /></li>
<li><img src="../picture/7.png" width="500" height=200px /></li>
<li><img src="../picture/ndky.jpg" width="500" height=200px /></li> <li><img src="../picture/4.jpg" width="500" height=200px/></li>
</ul>
<ol>
<li><a href="../index.html.html">主页</a></li>
<li><a href="#">挚爱</a></li>
<li><a href="#">经历</a></li>
<li><a href="#">偶像</a></li>
</ol>
<div id="arr">
<span id="left"><</span>
<span id="right">></span>
</div>
</div>
</div>
</body>
</html>