<!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=gb2312" />
<title>广告代码_http://www.111cn.net</title>
<style type="text/css教程">
/* reset style */
* { margin:0; padding:0; word-break:break-all; }
body { background:#fff; color:#333; font:12px/1.6em helvetica, arial, sans-serif; }
h1, h2, h3, h4, h5, h6 { font-size:1em; }
a { color:#039; text-decoration:none; }
a:hover { text-decoration:underline; }
ul, li { list-style:none; }
fieldset, img { border:none; }
em, strong, cite, th { font-style:normal; font-weight:normal; }
/* focus_change style */
#focus_change { position:relative; width:450px; height:295px; overflow:hidden; margin:20px 0 1px 60px; }
#focus_change_list { position:absolute; width:1800px; height:295px; }
#focus_change_list li { float:left; }
#focus_change_list li img { width:450px; height:295px; }
.focus_change_opacity { position:absolute; width:450px; height:70px; top:225px; left:0; background:#000; filter:alpha(opacity=50); -moz-opacity:0.5; opacity: 0.5; }
#focus_change_btn { position:absolute; width:450px; height:65px; top:225px; left:0; }
#focus_change_btn ul { padding-left:5px; }
#focus_change_btn li { display:inline; float:left; margin:0 15px; padding-top:12px; }
#focus_change_btn li img { width:76px; height:50px; border:2px solid #888; }
#focus_change_btn .current { background:url(icon_arrow.gif) no-repeat 37px 8px;}
#focus_change_btn .current img { border-color:#eee; }
</style>
<script type="text/网页特效">
function $(id) { return document.getelementbyid(id); }
function moveelement(elementid,final_x,final_y,interval) {
if (!document.getelementbyid) return false;
if (!document.getelementbyid(elementid)) return false;
var elem = document.getelementbyid(elementid);
if (elem.movement) {
cleartimeout(elem.movement);
}
if (!elem.style.left) {
elem.style.left = "0px";
}
if (!elem.style.top) {
elem.style.top = "0px";
}
var xpos = parseint(elem.style.left);
var ypos = parseint(elem.style.top);
if (xpos == final_x && ypos == final_y) {
return true;
}
if (xpos < final_x) {
var dist = math.ceil((final_x - xpos)/10);
xpos = xpos + dist;
}
if (xpos > final_x) {
var dist = math.ceil((xpos - final_x)/10);
xpos = xpos - dist;
}
if (ypos < final_y) {
var dist = math.ceil((final_y - ypos)/10);
ypos = ypos + dist;
}
if (ypos > final_y) {
var dist = math.ceil((ypos - final_y)/10);
ypos = ypos - dist;
}
elem.style.left = xpos + "px";
elem.style.top = ypos + "px";
var repeat = "moveelement('"+elementid+"',"+final_x+","+final_y+","+interval+")";
elem.movement = settimeout(repeat,interval);
}
function classnormal(){
var focusbtnlist = $('focus_change_btn').getelementsbytagname('li');
for(var i=0; i<focusbtnlist.length; i++) {
focusbtnlist[i].classname='';
}
}
function focuschange() {
var focusbtnlist = $('focus_change_btn').getelementsbytagname('li');
focusbtnlist[0].onmouseo教程ver = function() {
moveelement('focus_change_list',0,0,5);
classnormal()
focusbtnlist[0].classname='current'
}
focusbtnlist[1].onmouseover = function() {
moveelement('focus_change_list',-450,0,5);
classnormal()
focusbtnlist[1].classname='current'
}
focusbtnlist[2].onmouseover = function() {
moveelement('focus_change_list',-900,0,5);
classnormal()
focusbtnlist[2].classname='current'
}
focusbtnlist[3].onmouseover = function() {
moveelement('focus_change_list',-1350,0,5);
classnormal()
focusbtnlist[3].classname='current'
}
}
setinterval('autofocuschange()', 5000);
function autofocuschange() {
var focusbtnlist = $('focus_change_btn').getelementsbytagname('li');
for(var i=0; i<focusbtnlist.length; i++) {
if (focusbtnlist[i].classname == 'current') {
var currentnum = i;
}
}
if (currentnum==0 ){
moveelement('focus_change_list',-450,0,5);
classnormal()
focusbtnlist[1].classname='current'
}
if (currentnum==1 ){
moveelement('focus_change_list',-900,0,5);
classnormal()
focusbtnlist[2].classname='current'
}
if (currentnum==2 ){
moveelement('focus_change_list',-1350,0,5);
classnormal()
focusbtnlist[3].classname='current'
}
if (currentnum==3 ){
moveelement('focus_change_list',0,0,5);
classnormal()
focusbtnlist[0].classname='current'
}
}
window.onload=function(){
focuschange();
}
</script>
</head>
<body>
<div id="focus_change">
<div id="focus_change_list" style="top:0; left:0;">
<ul>
<li><img src="img/01.jpg"/></li>
<li><img src="img/02.jpg"/></li>
<li><img src="img/03.jpg"/></li>
<li><img src="img/04.jpg"/></li>
</ul>
</div>
<div class="focus_change_opacity"></div>
<div id="focus_change_btn">
<ul>
<li class="current"><a href="#"><img src="img/btn_01.jpg" alt="" /></a></li>
<li><a href="#"><img src="img/btn_02.jpg"/></a></li>
<li><a href="#"><img src="img/btn_03.jpg"/></a></li>
<li><a href="#"><img src="img/btn_04.jpg"/></a></li>
</ul>
</div>
</div><!--focus_change end-->
<br />
<a href="http://www.111cn.net/" target="_blank" style="font-size:14px; color:#003366; margin-left:180px;">整理自壹聚教程网</a>
</body>
</html>
源码下载地址
http://down.111cn.net/down/code/js/xiangcedaima/2010/0911/20752.html