论坛交流
首页办公自动化| 网页制作| 平面设计| 动画制作| 数据库开发| 程序设计| 全部视频教程
应用视频: Windows | Word2007 | Excel2007 | PowerPoint2007 | Dreamweaver 8 | Fireworks 8 | Flash 8 | Photoshop cs | CorelDraw 12
编程视频: C语言视频教程 | HTML | Div+Css布局 | Javascript | Access数据库 | Asp | Sql Server数据库Asp.net  | Flash AS
当前位置 > 文字教程 > Javascript教程
Tag:验证,特效,入门,实例,验证,表单,特效,正则表达式,跑马灯,document,函数,代码,getElementByID,菜单,图片,视频教程

Javascript教程_新闻列表鼠标滑过,显示单条详情的js

文章类别:Javascript | 发表日期:2010-5-4 8:50:36

<script type="text/javascript">
(function(oList){
    for (var i=0;i<=oList.length;i++){
    var obj=document.getElementById(oList[i]);
    var liObj=obj.getElementsByTagName("li");
    var length=liObj.length;
    for(var i=0;i<length;i++){
        liObj[i].onmouseover=function(){
            this.className+=" hover";
        }
        liObj[i].onmouseout=function(){
            this.className=this.className.replace('hover','');
        }
    }
    }
})([ID1,ID2,ID3...,IDN]);
</script>

<!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>demo</title>
<style type="text/css">
body { font-size:12px; }
ul, h2, p { margin:0; padding:0; }
.list { list-style:none; width:400px; position:relative; vertical-align:middle; }
.list li { border-bottom:solid 1px #eee; cursor:default; position:relative; width:100%; }
.list h2 { font-size:100%; font-weight:normal; padding:.5em;}
.list span { position:absolute; right:1em; top:.5em; font-family:Verdana; font-size:90%;}
.list div { display:none; position:relative; height:70px; }
.list div img { float:left; margin:.8em 1em; background:#6FF; }
.list div p { padding:.8em; }
.list div p strong { display:block; margin-bottom:.5em; }
.list li:hover, .list li.hover { height:auto; }
.list li:hover div, .list li.hover div { display:block; }
.list li:hover h2, .list li.hover h2, .list li:hover span, .list li.hover span { background:#5B86BB; color:#fff; }
</style>
</head>
<body>
<ul class="list" id="demo">
 <li>
  <h2>蓝色理想之经典论坛</h2>
  <span>2010-04-19</span>
  <div> <img src="http://bbs.blueidea.com/images/default/logo.gif" alt="" width="100" height="50" />
   <p><strong>蓝色理想之经典论坛</strong>大家都来经典论坛积极交流吧!</p>
  </div>
 </li>
 <li>
  <h2>蓝色理想之经典论坛</h2>
  <span>2010-04-19</span>
  <div> <img src="http://bbs.blueidea.com/images/default/logo.gif" alt="" width="100" height="50" />
   <p><strong>蓝色理想之经典论坛</strong>大家都来经典论坛积极交流吧!</p>
  </div>
 </li>
 <li>
  <h2>蓝色理想之经典论坛</h2>
  <span>2010-04-19</span>
  <div> <img src="http://bbs.blueidea.com/images/default/logo.gif" alt="" width="100" height="50" />
   <p><strong>蓝色理想之经典论坛</strong>大家都来经典论坛积极交流吧!</p>
  </div>
 </li>
 <li>
  <h2>蓝色理想之经典论坛</h2>
  <span>2010-04-19</span>
  <div> <img src="http://bbs.blueidea.com/images/default/logo.gif" alt="" width="100" height="50" />
   <p><strong>蓝色理想之经典论坛</strong>大家都来经典论坛积极交流吧!</p>
  </div>
 </li>
 <li>
  <h2>蓝色理想之经典论坛</h2>
  <span>2010-04-19</span>
  <div> <img src="http://bbs.blueidea.com/images/default/logo.gif" alt="" width="100" height="50" />
   <p><strong>蓝色理想之经典论坛</strong>大家都来经典论坛积极交流吧!</p>
  </div>
 </li>
 <li>
  <h2>蓝色理想之经典论坛</h2>
  <span>2010-04-19</span>
  <div> <img src="http://bbs.blueidea.com/images/default/logo.gif" alt="" width="100" height="50" />
   <p><strong>蓝色理想之经典论坛</strong>大家都来经典论坛积极交流吧!</p>
  </div>
 </li>
 <li>
  <h2>蓝色理想之经典论坛</h2>
  <span>2010-04-19</span>
  <div> <img src="http://bbs.blueidea.com/images/default/logo.gif" alt="" width="100" height="50" />
   <p><strong>蓝色理想之经典论坛</strong>大家都来经典论坛积极交流吧!</p>
  </div>
 </li>
</ul>
<ul class="list" id="demo1">
 <li>
  <h2>蓝色理想之经典论坛</h2>
  <span>2010-04-19</span>
  <div> <img src="http://bbs.blueidea.com/images/default/logo.gif" alt="" width="100" height="50" />
   <p><strong>蓝色理想之经典论坛</strong>大家都来经典论坛积极交流吧!</p>
  </div>
 </li>
 <li>
  <h2>蓝色理想之经典论坛</h2>
  <span>2010-04-19</span>
  <div> <img src="http://bbs.blueidea.com/images/default/logo.gif" alt="" width="100" height="50" />
   <p><strong>蓝色理想之经典论坛</strong>大家都来经典论坛积极交流吧!</p>
  </div>
 </li>
 <li>
  <h2>蓝色理想之经典论坛</h2>
  <span>2010-04-19</span>
  <div> <img src="http://bbs.blueidea.com/images/default/logo.gif" alt="" width="100" height="50" />
   <p><strong>蓝色理想之经典论坛</strong>大家都来经典论坛积极交流吧!</p>
  </div>
 </li>
 <li>
  <h2>蓝色理想之经典论坛</h2>
  <span>2010-04-19</span>
  <div> <img src="http://bbs.blueidea.com/images/default/logo.gif" alt="" width="100" height="50" />
   <p><strong>蓝色理想之经典论坛</strong>大家都来经典论坛积极交流吧!</p>
  </div>
 </li>
 <li>
  <h2>蓝色理想之经典论坛</h2>
  <span>2010-04-19</span>
  <div> <img src="http://bbs.blueidea.com/images/default/logo.gif" alt="" width="100" height="50" />
   <p><strong>蓝色理想之经典论坛</strong>大家都来经典论坛积极交流吧!</p>
  </div>
 </li>
 <li>
  <h2>蓝色理想之经典论坛</h2>
  <span>2010-04-19</span>
  <div> <img src="http://bbs.blueidea.com/images/default/logo.gif" alt="" width="100" height="50" />
   <p><strong>蓝色理想之经典论坛</strong>大家都来经典论坛积极交流吧!</p>
  </div>
 </li>
 <li>
  <h2>蓝色理想之经典论坛</h2>
  <span>2010-04-19</span>
  <div> <img src="http://bbs.blueidea.com/images/default/logo.gif" alt="" width="100" height="50" />
   <p><strong>蓝色理想之经典论坛</strong>大家都来经典论坛积极交流吧!</p>
  </div>
 </li>
</ul>
</body>
</html>
<script type="text/javascript">
(function(oList){
    for (var i=0;i<=oList.length;i++){
 var obj=document.getElementById(oList[i]);
 var liObj=obj.getElementsByTagName("li");
 var length=liObj.length;
 for(var i=0;i<length;i++){
  liObj[i].onmouseover=function(){
   this.className+=" hover";
  }
  liObj[i].onmouseout=function(){
   this.className=this.className.replace('hover','');
  }
 }
    }
})(["demo","demo1"]);
</script>

视频教程列表
文章教程搜索
 
Javascript推荐教程
Javascript热门教程
看全部视频教程
购买方式/价格
购买视频教程: 咨询客服
tel:15972130058