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>
上一篇: 拖拽原生js
下一篇: js玩转多个div互换
推荐阅读
-
js中switch case循环一例
-
一种openresty在init_by_lua_file阶段读取redis到共享内存的方法
-
mysql 一次更新(update)多条记录
-
OpenGL学习之路3----画一个三角形
-
基于jQuery实现的菜单切换效果_jquery
-
3维数组转成一条一条数据有关问题
-
Win10 Mobile一周年更新发布/慢速预览版14393.351推送
-
node.js - windows的服务器,一个文件夹最多能放多少个文件而不会影响php/nodejs/java等读取文件的速度?
-
2018蓝桥杯模拟赛(一)I【容斥原理】
-
phpQuery让php处理html代码像jQuery一样方便,phpqueryjquery