日期:2014-05-16  浏览次数:20489 次

网站首页js幻灯片代码

<%@ page language="java" contentType="text/html"
??? pageEncoding="utf-8"%>
<html>
<head>
<title>JS图片幻灯片</title>
<style>
*{margin:0;padding:0;}
ul,li,ol{ list-style:none;}
img,a img{ border:none;}
table{ border-collapse:collapse; border-spacing:0;}
em,i,u{ font-style:normal;}
a{ text-decoration:none;color:#434343;}
a:hover{ text-decoration:underline; color:#ff4000;}
body{font-size:12px; font-family:"宋体";color:#434343;}
.clear{clear:both;? font-size:0; overflow:hidden; height:0;}
.blank10{clear:both;? font-size:0; overflow:hidden; height:10px;}
.blank{clear:both;? font-size:0; overflow:hidden; height:10px; background:#FFF;}
/*********content css定义***********/
#content{width:960px;margin:0 auto;}
h1,h2,h3{ font-family:"微软雅黑";color:#00659b;}
h1,h2,h3,h4,h5,h6{ font-weight:bold;}
#footer{padding-bottom:0;margin:0px auto 0;}
/*********main css定义***********/
.mb15 {margin-bottom: 0px;}
#main{width:960px; margin:6px auto 10px; overflow:hidden;}
/*********图片切换 css定义***********/
.sub_box{width:663px; height:310px; float:left; position:relative; overflow:hidden; border:1px solid #cccccc; background:url() center center no-repeat; *background:url() 220px 120px no-repeat;}
.sub_box img{border:none; width:663px; height:310px;}
#bd1lfimg{position:relative; width:663px; height:310px; overflow:hidden;}
#bd1lfimg div{width:100000px; margin-left:-4px;}
#bd1lfimg dl{width:663px; height:310px; position:relative; overflow:hidden; float:left;}
#bd1lfimg dt{width:663px; height:310px; position:absolute; left:0px; top:0px;}
#bd1lfimg dd{width:623px; height:80px; background:#000000; filter:alpha(Opacity=70); Opacity:0.7; position:absolute; left:0px; bottom:0px; padding:0 20px;}
#bd1lfimg dd h2{height:25px; padding:8px 0 4px 0; line-height:25px; overflow:hidden;}
#bd1lfimg dd h2 a{font-size:14px; font-weight:bold; color:#ffffff;}
#bd1lfimg dd a{color:#ffffff; text-decoration:none;}
#bd1lfimg dd a:hover{text-decoration:none; color:#cccccc;}
#bd1lfimg dd tt{color:#dddddd; line-height:1.2em;}
#bd1lfimg dd tt a:hover{text-decoration:underline;}
.sub_nav{width:663px; height:25px; bottom:0px; position:absolute; color:#999999; z-index:200;}
.sub_no{height:25px; float:right;}
.sub_no li{display:block; width:25px; height:25px; float:left; overflow:hidden; line-height:25px; vertical-align:middle; text-align:center; background:#000000; filter:alpha(Opacity=70); Opacity:0.7; font-family:Arial; font-size:11px; color:#999999; cursor:pointer;}
.sub_no li.show{background:#ffffff; color:#000000;}
.sub_more{float:right; width:50px; height:25px; background:#000000; filter:alpha(Opacity=70); Opacity:0.7; color:#999999; text-align:center; line-height:25px;}
.sub_more a{color:#999999;}
.sub_more a:hover{color:#cccccc; text-decoration:none;}
</style>
<script type="text/javascript">
//选择器
function $a(id,tag){var re=(id&&typeof id!="string")?id:document.getElementById(id);if(!tag){return re;}else{return re.getElementsByTagName(tag);}}

//焦点滚动图 点击移动
function movec()
{
?var o=$a("bd1lfimg","");
?var oli=$a("bd1lfimg","dl");
??? var oliw=oli[0].offsetWidth; //每次移动的宽度?
?var ow=o.offsetWidth-2;
?var dnow=0; //当前位置?
?var olf=oliw-(ow-oliw+10)/2;
??o["scrollLeft"]=olf+(dnow*oliw);
?var rqbd=$a("bd1lfsj","ul")[0];
?var extime;

?<!--for(var i=1;i<oli.length;i++){rqbd.innerHTML+="<li>"+i+"</li>";}-->
?var rq=$a("bd1lfsj","li");
?for(var i=0;i<rq.length;i++){reg(i);};
?oli[dnow].className=rq[dnow].className="show";
?var wwww=setInterval(uu,2000);

?function reg(i){rq[i].onclick=function(){oli[dnow].className=rq[dnow].className="";dnow=i;oli[dnow].className=rq[dnow].className="show";mv();}}
?function mv(){clearInterval(extime);clearInterval(wwww);extime=setInterval(bc,15);wwww=