<div class="codetitle"> <span><a style="CURSOR: pointer" data="1121" class="copybut" id="copybut1121" onclick="doCopy('code1121')"><u>复代码码</u></a></span> 代码如下:</div> <div class="codebody" id="code1121"> <br><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 전환//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <br><html xmlns="http://www.w3.org/1999/xhtml"> <br><머리> <br><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <br><title>mypaly</title> <br><style type="text/css"> <br>* { 여백:0; padding:0;} <br>ul, li { list-style:none;} <br>body{ <br>text-align:center; <br>} <br>#play{ <br>너비:400px; <br>높이:300px; <br>위치:절대; <br>왼쪽:50%; <br>상위:50%; <br>여백:-155px 0 0 -205px; <br>오버플로:숨김; <br><br>} <br>#playimg{ <br>너비:400px; <br>높이:300px; <br>위치:절대; <br>} <br>#playimg li{ <br>높이:300px; <br>오버플로:숨김; <br>} <br>#playimg img{ <br>너비:400px; <br>높이:300px; <br>} <br>#playbtn{ <br>위치:절대; <br>왼쪽:0; <br>하단:5px; <br>} <br>#playbtn li{ <br>display:inline; <br>배경:#eee; <br>패딩:2px 5px; <br>여백:0 3px; <br>커서:포인터; <br>} <br>#playbtn .current{ <br>배경:#f0f; <br>} <br></style> <br><script type="text/javascript"> if (!document.getElementById(elementID))가 false를 반환하는 경우; <br>var elem = document.getElementById(elementID); <br>if (elem.movement) { <br>clearTimeout(elem.movement); <br>} <br>if (!elem.style.left) { <br>elem.style.left = "0px"; <br>} <br>if (!elem.style.top) { <br>elem.style.top = "0px"; <br>} <br>var xpos =parseInt(elem.style.left); <br>var ypos =parseInt(elem.style.top); <br>if (xpos == final_x && ypos == final_y) { <br> true를 반환합니다. <br>} <br>if (xpos < final_x) { <BR>var dist = Math.ceil((final_x - xpos)/10); <BR>xpos = xpos dist; <BR>} <BR>if (xpos > final_x) { <br>var dist = Math.ceil((xpos - final_x)/10); <br>xpos = xpos - 거리; <br>} <br>if (ypos < final_y) { <BR>var dist = Math.ceil((final_y - ypos)/10); <BR>ypos = ypos dist; <BR>} <BR>if (ypos > final_y) { <br>var dist = Math.ceil((ypos - final_y)/10); <br>ypos = ypos - 거리; <br>} <br>elem.style.left = xpos "px"; <br>elem.style.top = ypos "px"; <br>varpeat = "moveElement('" elementID "'," final_x "," final_y "," 간격 ")"; <br>elem.movement = setTimeout(반복, 간격); <br>} <br>function imgChange(num){//切换图文焦点 <br>if(!$('play')) return false; <br>var piclist=$('playimg').getElementsByTagName('img'); <br>var imgheight=piclist[0].offsetHeight; <br>var moveY=-(imgheight*num); <br>moveElement('playimg',0,moveY,5); <br>} <br>함수 classToggle(arr,n){//切换按钮样式 <br>for(var i=0;i<arr.length;i ){ <BR>arr[i].className=' '; <BR>} <BR>arr[n].className='현재'; <BR>} <BR>함수 btnChange(btns){//鼠标移动播放 <BR>if(!$(btns)) return false; <BR>$('play').onmouseover = function(){autokey = false}; <BR>$('play').onmouseout = function(){autokey = true}; <BR>var arr=$(btns).getElementsByTagName('li'); <BR>for(var i=0;i<arr.length;i ){ <BR>arr[i].index=i;//设置索引号 <BR>arr[i].onmouseover=function(){ <BR>//var num=index(this,arr); <BR>classToggle(arr,this.index); <BR>imgChange(this.index); <BR>} <BR>} <BR>} <BR>function autoChange(btns){ <BR>if(!$(btns)) return false; <BR>if(!autokey)는 false를 반환합니다. <BR>var arr=$(btns).getElementsByTagName('li'); <BR>for(var i=0;i<arr.length;i ){ <BR>if(arr[i].className=='current'){ <BR>var n=i 1; <BR>} <BR>} <BR>if(n>=arr.length) n=0; <br>classToggle(arr,n); <br>imgChange(n); <br>} <br>var autokey = true; <br>setInterval("autoChange('playbtn')",3000); <br>window.onload=function(){ <br>btnChange('playbtn'); <br>} <br></script> <br></head> <br><br><본문> <br><div id="play"> <br><ul id="playimg"> <br><li><img src="../images/Blue hills.jpg" alt="" /></li> <br><li><img src="../images/Sunset.jpg" alt="" /></li> <br><li><img src="../images/Water lilies.jpg" alt="" /></li> <br><li><img src="../images/Winter.jpg" alt="" /></li> <br></ul> <br><ul id="playbtn"><li class="current">1</li><li>2</li><li>3</li><li> 4</li></ul> <br></div> <br></body> <br></html> <br><br> </div>