CSS+JavaScript实现层级显示隐藏
/***************************by
garcon1986********************************/
感谢CSDN的shan1119 帮我解决Javascript部分的错误。
<mce:script language="JavaScript"><!--
function toggle(id,id2,id3) {
var state = document.getElementById(id).style.display;
if (state == 'block') {
document.getElementById(id).style.display = 'none';
if (id2 != undefined)document.getElementById(id2).style.display = 'none';
if (id3 != undefined)document.getElementById(id3).style.display = 'none';
} else {
document.getElementById(id).style.display = 'block';
}
}
// --></mce:script>
<mce:style type="text/css"><!--
#main{
position:relative;
top:20px;
left:20px;
width:200px;
background: lightblue;
}
#hidden {
position:relative;
top:0px;
left:280px;
width:200px;
background: lightgrey;
display: none;
}
#hidden2 {
position:relative;
top:-20px;
left:580px;
width:200px;
background: lightgreen;
display: none;
}
#hidden3 {
position:relative;
top:100px;
left:0px;
width:200px;
background: lightpink;
display: none;
}
--></mce:style><style type="text/css" mce_bogus="1">#main{
position:relative;
top:20px;
left:20px;
width:200px;
background: lightblue;
}
#hidden {
position:relative;
top:0px;
left:280px;
width:200px;
background: lightgrey;
display: none;
}
#hidden2 {
position:relative;
top:-20px;
left:580px;
width:200px;
background: lightgreen;
display: none;
}
#hidden3 {
position:relative;
top:100px;
left:0px;
width:200px;
background: lightpink;
display: none;
}</style>
<div id="main" onclick="toggle('hidden','hidden2','hidden3');">
1
</div>
<div id="hidden" onclick="toggle('hidden2','hidden3')">
1.1
</div>
<div id="hidden2"onclick="toggle('hidden3');">
1.1.1
</div>
<div id="hidden3">
1.1.1.1
</div>
原帖:http://t
相关文档:
J2me中css解析
最近做手机浏览器项目中的CSS模块。对解析css有了个整体认识。现总结如下:
首先,简单的介绍下CSS :
CSS 指层叠样式表 (Cascading Style Sheets)
CSS 语法由三部分构成:选择器、属性和值:selector {property: value}
选择器 (selector) 通常是你希望定义的 ......
/// <summary>
/// 判断是否为正小数
/// </summary>
/// <param name="str"></param>
/// <returns>为正小数时返回true,其他返回false</returns>
public static bool IsDecimal(string str)
{
//声明Regex对象变量
Regex objAlp ......
昨天去老家的书店买了本《JavaScript征途》,这本书。。。娘娘,。。这书还真他妈的贵。。原价。。89.00,打完折还有80.00我操。。
看来计算机类的图书还不是一般的价类。。。
想想。。。自己还有好多的技术没有学完的类。。。XHTML,CSS,JavaScript,C#2.0,c#3.0.。asp.net2.0,asp.net3.5
现在c#又要出4.0了。。。我 ......
keycode 8 = BackSpace BackSpace
keycode 9 = Tab Tab
keycode 12 = Clear
keycode 13 = Enter
keycode 16 = Shift_L
keycode 17 = Control_L
keycode 18 = Alt_L
keycode 19 = Pause
keycode 20 = Caps_Lock
keycode 27 = Escape Escape
keycode 32 = space space
keycode 33 = Prior
keycode 34 ......
我们知道,javascript在执行期时是由内到外执行脚本的,那么离我们的脚本最远的全局对象,很可能要跨越几层作用域对能访问到它。不过在IE中,从最内层到最外层要花的时间比其他多出很多。加之,javascript是一种胶水语言,它必须要调用DOM对能完成我们大多数选择。最著名的就是选择元素(document.getElementById,documen ......