欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

DIV 切换(一)

程序员文章站 2022-07-14 16:45:46
...


<%@ page language="java" contentType="text/html; charset=utf-8"
pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Servlet service</title>
<link type="text/css" href="css/firstpage.css" rel="stylesheet"></link>
</head>
<SCRIPT type="text/javascript">


var nFocus = 0;
var bFlag = false;
var aLiTab, aDivTab;
function c1() {

var $ = function c($) {
return document.getElementById($);
};


aLiTab = $("oUlTab").getElementsByTagName("li");
aDivTab = [$("oDivTab1"), $("oDivTab2"), $("oDivTab100")];

for (var i = 0; i < aLiTab.length; i++) {
(

function(i) {
var t = aLiTab[i];
t.onclick = function c() {
if (nFocus != i) {
aLiTab[nFocus].className = "";
aDivTab[nFocus].style.display = "none";
nFocus = i;
aLiTab[nFocus].className = "on";
aDivTab[nFocus].style.display = "";
}
bFlag = true;
};
t.onmouseout = function c() {
bFlag = false;
};
}


) (i);
}
};

</script>


<script type="text/javascript">

window.onload = function() {
c1();
}

</script>


<body>
<div class="bdtg-tit">
<ul id="oUlTab">
<li class="on"><a href="#"><p>a</p></a></li>


<li><a href="#"><p>b</p></a></li>


<li><a href="#"><p>c</p></a></li>
</ul>
</div>


<div class="bq_d" id="oDivTab1">
<div class="bq_n">
<div class="bdtg-list">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td i Align="top">content1</td>
</tr>
</table>
</div>

</div>
</div>


<div class="bq_d" id="oDivTab2" style="DISPLAY: none">
<div class="bq_n">

<div class="bdtg-list">

<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td vAlign="top">content2</td>
</tr>
</table>


</div>
</div>
</div>


<div class="bq_d" id="oDivTab100" style="DISPLAY: none">
<div class="bq_n">
<div class="bdtg-list">


<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td vAlign="top">content3</td>
</tr>
</table>


</div>
</div>
</div>


</body>
</html>

相关标签: javascript html