关于js和层,我有N个div隐藏层,谁能帮我做个例子

来源:百度知道 编辑:UC知道 时间:2024/06/22 17:19:01
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<style>
<!--
#aaa{
position:absolute;
display:none;
width:300px;
height:130px;
background-color:#FFFFFF;
border:1px #CCCCCC solid;
}
#b{
height:20px;
text-align:right;
font-size:12px;
border-bottom:1px #CCCCCC solid;
line-height:20px;
width:94%;
float:left;
text-align:center;
cursor:hand;
}
#c{
height:20px;
text-align:right;
font-size:12px;
border-bottom:1px #CCCCCC solid;
line-height:20px;
width:5%;
float:left;
}
#d{
font-size:12px;
padding:10px;

很简单,样式不要用#,用#开头的话,就锁定了id对象,所以如果你要控制多个而且样式是一样的,就用.来表示,这样就可以用class定义样式了,还有就是js方面,用一个方法来调用,这是代码,你自已慢慢看
<!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>无标题文档</title>
<style>
<!--
.aaa{
position:absolute;
display:none;
width:300px;
height:130px;
background-color:#FFFFFF;
border:1px #CCCCCC solid;
}
.b{
height:20px;
text-align:right;
font-size:12px;
border-bottom:1px #CCCCCC solid;