最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

JS+DIV+CSS排版布局實(shí)現(xiàn)美觀的選項(xiàng)卡效果

 更新時(shí)間:2015年10月10日 10:42:44   作者:企鵝  
這篇文章主要介紹了JS+DIV+CSS排版布局實(shí)現(xiàn)美觀的選項(xiàng)卡效果,通過簡單的div+css布局結(jié)合JavaScript切換頁面樣式實(shí)現(xiàn)美觀的選項(xiàng)卡效果,具有一定參考借鑒價(jià)值,需要的朋友可以參考下

本文實(shí)例講述了JS+DIV+CSS排版布局實(shí)現(xiàn)美觀的選項(xiàng)卡效果。分享給大家供大家參考。具體如下:

這是一個(gè)基于JavaScript的簡單選項(xiàng)卡代碼,陪新手練習(xí)一下Div+CSS排版的技巧,本選項(xiàng)卡可以繼續(xù)美化修飾完善,選項(xiàng)卡在目前在眾多網(wǎng)站上應(yīng)用廣泛,確實(shí)是一個(gè)很不錯(cuò)的網(wǎng)頁布局方法。

運(yùn)行效果截圖如下:

在線演示地址如下:

http://demo.jb51.net/js/2015/js-div-css-pbbj-nav-demo/

具體代碼如下:

<!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>DIV CSS排版</title>
<style type="text/css"> 
<!--
body,ul{margin:0; padding:0; list-style:none; font:12px "宋體";}
.test {
 width:500px; 
 margin:20px auto; 
 height:150px;
 background:url("images/9zrgo3.jpg") repeat-x 0 33px; 
 }
.test ul li { 
 float:left; 
 padding:2px 1px 6px 1px; 
 background: url("images/11abdrs.jpg") no-repeat 0 0; 
 }
.test ul li a {
 color:#000;
 width:95px; 
 text-decoration:none; 
 display:block; 
 height:27px;
 line-height:31px;
 text-align:center;
 overflow:hidden;
 }
.test ul li a:hover{
 color:#30F;
 background:#FFF url("images/2vi1df8.jpg") repeat-x 0 0px; 
 }
.test ul li.yes {padding:0;border:none;}
.test ul li.yes a {
 color:#30F;
 width:112px;
 height:35px;
 line-height:40px;
 display:block;
 font-weight:bold;
 margin-bottom:-5px;
 background: url("images/27zgcqc.jpg") no-repeat 0px 0; 
 overflow:hidden;
 } 
.content {
 line-height:50px;
 text-align:center;
 font-size:20px;
 color:red;
 height:112px;
 border:#F8BE05 2px solid; 
 border-top:none; 
 clear:both;
 background:#ECED78;
 }
.no { display:none;}
-->
</style>
<script type="text/javascript" language="javascript"> 
 function test_item(n){
  var menu = document.getElementById("menu");
  var menuli = menu.getElementsByTagName("li");
  for(var i = 0; i< menuli.length;i++){
   menuli[i].className= "";
   menuli[n].className="yes";
   document.getElementById("test"+ i).className = "no";
   document.getElementById("test"+ n).className = "content";
  }
 }
</script>
</head>
<body>
<div class="test">
 <ul id="menu">
  <li class="yes" onclick="javascript:test_item(0);"><a href="#" onfocus="this.blur()">首頁</a></li>
  <li onclick="javascript:test_item(1);"><a href="#" onfocus="this.blur()">連接一</a></li>
  <li onclick="javascript:test_item(2);"><a href="#" onfocus="this.blur()">連接二</a></li>
  <li onclick="javascript:test_item(3);"><a href="#" onfocus="this.blur()">連接三</a></li>
  <li onclick="javascript:test_item(4);"><a href="#" onfocus="this.blur()">連接四</a></li>
 </ul>
 <div class="content" id="test0">
  首頁內(nèi)容
 </div>
 <div id="test1" class="no">
  連接一內(nèi)容
 </div>
 <div id="test2" class="no">
  連接二內(nèi)容
 </div>
 <div id="test3" class="no">
  連接三內(nèi)容
 </div>
 <div id="test4" class="no">
  連接四內(nèi)容
 </div>
</div>
</body>
</html>

希望本文所述對(duì)大家的JavaScript程序設(shè)計(jì)有所幫助。

相關(guān)文章

最新評(píng)論

大厂| 浙江省| 玉环县| 安福县| 姚安县| 兰溪市| 伊宁县| 甘南县| 吉安市| 兴文县| 库车县| 英超| 濉溪县| 乐业县| 静宁县| 温泉县| 赤城县| 塔河县| 五大连池市| 西丰县| 紫金县| 富源县| 韶关市| 博罗县| 罗田县| 临桂县| 临沂市| 肥东县| 桑日县| 惠水县| 松滋市| 神木县| 彭州市| 桑植县| 顺昌县| 泊头市| 聂拉木县| 监利县| 陕西省| 康保县| 临沂市|