JS 简单实现Ext.TabPanel效果(转载)
2014-02-28 11:03
671 查看
<html>
<head>
<title>一个TAB页的简单JS实现</title>
<style type="text/css">
#div0{
width:300px;
margin:0 auto;
}
#div1{
border:1px solid blue;
border-bottom:0px solid blue;
float:left;
}
#div2{
border-right:1px solid blue;
border-top:1px solid blue;
float:left;
}
#div3{
border:1px solid blue;
clear:left;
}
#div4{
border:1px solid blue;
clear:left;
}
</style>
<script language="javascript">
window.onload=function(){
document.getElementById("div1").style.backgroundColor="yellow";
document.getElementById("div4").style.display="none";
}
function foo(){
document.getElementById("div1").style.backgroundColor="yellow";
document.getElementById("div2").style.backgroundColor="";
document.getElementById("div3").style.display="none";
document.getElementById("div4").style.display="block";
}
function bar(){
document.getElementById("div1").style.backgroundColor="";
document.getElementById("div2").style.backgroundColor="yellow";
document.getElementById("div3").style.display="block";
document.getElementById("div4").style.display="none";
}
</script>
</head>
<body>
<div id="div0">
<div id="div1" onmouseover="foo()">标题一</div>
<div id="div2" onmouseover="bar()">标题二</div>
<div id="div3">内容一</div>
<div id="div4">内容二</div>
</div>
</body>
</html>
<head>
<title>一个TAB页的简单JS实现</title>
<style type="text/css">
#div0{
width:300px;
margin:0 auto;
}
#div1{
border:1px solid blue;
border-bottom:0px solid blue;
float:left;
}
#div2{
border-right:1px solid blue;
border-top:1px solid blue;
float:left;
}
#div3{
border:1px solid blue;
clear:left;
}
#div4{
border:1px solid blue;
clear:left;
}
</style>
<script language="javascript">
window.onload=function(){
document.getElementById("div1").style.backgroundColor="yellow";
document.getElementById("div4").style.display="none";
}
function foo(){
document.getElementById("div1").style.backgroundColor="yellow";
document.getElementById("div2").style.backgroundColor="";
document.getElementById("div3").style.display="none";
document.getElementById("div4").style.display="block";
}
function bar(){
document.getElementById("div1").style.backgroundColor="";
document.getElementById("div2").style.backgroundColor="yellow";
document.getElementById("div3").style.display="block";
document.getElementById("div4").style.display="none";
}
</script>
</head>
<body>
<div id="div0">
<div id="div1" onmouseover="foo()">标题一</div>
<div id="div2" onmouseover="bar()">标题二</div>
<div id="div3">内容一</div>
<div id="div4">内容二</div>
</div>
</body>
</html>
相关文章推荐
- 【引用】自己封装的Extjs组件combox(2)
- 【引用】自己封装的Extjs组件GroupGrid(1)
- 【引用】自己封装的Extjs组件GroupGrid的代码(9) DateField TextField NumberField
- 用JSON改进AJAX数据传输ajax 处理json
- [js] 变量空值研究
- mouseover和mouseout事件在鼠标经过子元素时也会触发
- Extjs项目中uxForm.js
- js自定义对象
- JS图片滚动代码(无缝、平滑)
- 经典JavaScript正则表达式实战
- js 如何将字符串中的大于8位的数字保留前3位,后面的替换成“*”
- 探索JavaScript中Null和Undefined
- Json的初步学习、接触
- js判断字符输入个数校验
- Javascript 仿真 sprintf
- 使用Jsoup函数包抓取网页内容
- JSTL重定向标签注释不掉的问题
- JSON资料整理
- js继承有5种实现方式
- js 基础知识