<html>
<!-- 由于IE的区别也可能造成声明无效,于是奇耙的声明方式就有了,这但不但不会影响也十分的可靠,至于下面为什么要再次声明,
因为有时间你的IIS或者环境根本不是IIS那么这面的就会失效,但一般不会,下面的的UTF-8声明就是用来解决这上面不可用的可能性,
那么如果两次都是执行了会有什么影响呢,答案是没有。
先声明了 ZH-CN 简体中文后只指向UTF-8是不会有错误的结果的, 那么直接指向UTF-8不就可以了吗?答案是不可以,因为有的破服务器
的问题UTF-8的支持范围比较广,假如错误的认为你打的是韩文,那么显示出来的只能是以下形式(涓?€у寲閰嶇疆)即乱码,个人是这么解决
的,也不知道我的理解是否正确,但那么多年来 我一直是那么解决的,至少我认为是可靠对的即使别人没那么做,但我认为解决了没有BUG那么就是我们想要的
那么为什么win v~win8之间不会呢,因为系统只能越做越好, -->
<!DOCTYPE html>
<!--[if lt IE 7 ]><html class="ie6" lang="zh-cn"><![endif]-->
<!--[if IE 7 ]><html class="ie7" lang="zh-cn"><![endif]-->
<!--[if IE 8 ]><html class="ie8" lang="zh-cn"><![endif]-->
<!--[if IE 9 ]><html class="ie9" lang="zh-cn"><![endif]-->
<!--[if (gt IE 9)|!(IE)]><!-->
<html class="" lang="zh-cn">
<!--<![endif]-->
<head>
<!-- 声明编码,但有时也会出现各种奇耙情况比如IE的版本等!
由于服务器的兼容问题还有字集原因有时间UTF-8不一定能用,可以考虑GB2312
但这样的话港澳台的话可能出现问题。 -->
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<title>多级菜单</title>
<script type="text/javascript" src="jquery-2.0.1.js"></script>
</head>
<style type="text/css">
* {
margin: 0;
padding: 0;
}
li {
list-style: none;
}
.icoopen, .icoopen2, .icoclose, .icoclose2, .iconleaf, .iconleaf2,
.lmenu ul li span {
background: url("doc.png") no-repeat 0 0;
width: 9px;
height: 9px;
top: 9px;
}
em {
display: block;
position: absolute;
cursor: pointer;
}
.icoopen {
left: 28px;
background-position: 0 -39px;
}
.icoopen2 {
left: 42px;
background-position: -46px -88px;
}
.icoclose {
left: 28px;
background-position: -45px -39px;
}
.icoclose2 {
left: 42px;
background-position: 0 -88px;
}
.iconleaf, .iconleaf2 {
width: 3px;
height: 5px;
background-position: -87px -41px;
}
.iconleaf {
left: 47px;
top: 11px;
}
.iconleaf2 {
left: 72px;
top: 10px;
}
.lmenu {
margin: 50px 200px;
width: 250px;
height: auto;
overflow: hidden;
font-family: Tahoma, Helvetica, "Microsoft Yahei", "微软雅黑", Arial,
STHeiti;
margin-bottom: 10px;
border: 1px solid #AEB1B5;
}
.lmenu ul li {
position: relative;
cursor: pointer;
}
.lmenu ul li span {
display: block;
width: 100%;
height: 28px;
line-height: 28px;
text-indent: 3em;
/*font-weight: bolder;*/
font-size: 14px;
color: #0E3E5E;
border-bottom: 1px solid #D7D7D7;
background-position: -46px 0;
}
.lmenu ul li ul li, .lmenu ul li ul li span {
background-color: #F7F8F8;
color: #333;
text-indent: 5em;
font-size: 13px;
height: auto;
line-height: 28px;
}
.lmenu ul li ul li span {
background: none;
}
.lmenu ul li ul li ul li {
border: none;
text-indent: 7em;
font-size: 12px;
font-weight: normal;
height: 24px;
line-height: 24px;
}
</style>
<body>
<div class="lmenu">
<ul>
<li><span>一级菜单</span>
<ul>
<li><span>基本</span>
<ul>
<li>全屏</li>
<li>源码</li>
</ul></li>
<li><span>格式化</span>
<ul>
<li>全生生死死屏</li>
<li>源码</li>
</ul></li>
<li>个性化配置</li>
</ul></li>
<li><span>2级菜单</span>
<ul>
<li>我是2级菜单下面的</li>
<li>我是2级菜单下面的</li>
<li>我是2级菜单下面的</li>
<li>我是2级菜单下面的</li>
</ul></li>
</ul>
</div>
</body>
<script type="text/javascript">
$(document).ready(function() {
/*一级菜单的样式*/
$(".lmenu > ul > li > span").prepend('<em class="icoclose"></em>');
/*二级菜单的样式*/
$(".lmenu > ul > li > ul > li").each(function() {
/*检查是否有节点*/
span = $(this).find("span");
if (span.length) {
span.prepend('<em class="icoclose2"></em>');
} else {
$(this).prepend('<em class="iconleaf"></em>')
}
});
/*三级菜单的样式*/
$(".lmenu > ul > li > ul > li > ul > li").click(function() {
alert($(this).text());
}).prepend('<em class="iconleaf2"></em>');
$(".lmenu ul li span").click(function() {
var ye = $(this).find('em');
classNama = ye.attr("class");
if (classNama == 'icoclose') {
ye.attr('class', 'icoopen');
} else if (classNama == 'icoopen') {
ye.attr('class', 'icoclose');
} else if (classNama == 'icoclose2') {
ye.attr('class', 'icoopen2');
} else if (classNama == 'icoopen2') {
ye.attr('class', 'icoclose2');
}
$(this).siblings("ul").slideToggle("normal", "swing");
});
});
</script>
</html>
<!-- 由于IE的区别也可能造成声明无效,于是奇耙的声明方式就有了,这但不但不会影响也十分的可靠,至于下面为什么要再次声明,
因为有时间你的IIS或者环境根本不是IIS那么这面的就会失效,但一般不会,下面的的UTF-8声明就是用来解决这上面不可用的可能性,
那么如果两次都是执行了会有什么影响呢,答案是没有。
先声明了 ZH-CN 简体中文后只指向UTF-8是不会有错误的结果的, 那么直接指向UTF-8不就可以了吗?答案是不可以,因为有的破服务器
的问题UTF-8的支持范围比较广,假如错误的认为你打的是韩文,那么显示出来的只能是以下形式(涓?€у寲閰嶇疆)即乱码,个人是这么解决
的,也不知道我的理解是否正确,但那么多年来 我一直是那么解决的,至少我认为是可靠对的即使别人没那么做,但我认为解决了没有BUG那么就是我们想要的
那么为什么win v~win8之间不会呢,因为系统只能越做越好, -->
<!DOCTYPE html>
<!--[if lt IE 7 ]><html class="ie6" lang="zh-cn"><![endif]-->
<!--[if IE 7 ]><html class="ie7" lang="zh-cn"><![endif]-->
<!--[if IE 8 ]><html class="ie8" lang="zh-cn"><![endif]-->
<!--[if IE 9 ]><html class="ie9" lang="zh-cn"><![endif]-->
<!--[if (gt IE 9)|!(IE)]><!-->
<html class="" lang="zh-cn">
<!--<![endif]-->
<head>
<!-- 声明编码,但有时也会出现各种奇耙情况比如IE的版本等!
由于服务器的兼容问题还有字集原因有时间UTF-8不一定能用,可以考虑GB2312
但这样的话港澳台的话可能出现问题。 -->
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<title>多级菜单</title>
<script type="text/javascript" src="jquery-2.0.1.js"></script>
</head>
<style type="text/css">
* {
margin: 0;
padding: 0;
}
li {
list-style: none;
}
.icoopen, .icoopen2, .icoclose, .icoclose2, .iconleaf, .iconleaf2,
.lmenu ul li span {
background: url("doc.png") no-repeat 0 0;
width: 9px;
height: 9px;
top: 9px;
}
em {
display: block;
position: absolute;
cursor: pointer;
}
.icoopen {
left: 28px;
background-position: 0 -39px;
}
.icoopen2 {
left: 42px;
background-position: -46px -88px;
}
.icoclose {
left: 28px;
background-position: -45px -39px;
}
.icoclose2 {
left: 42px;
background-position: 0 -88px;
}
.iconleaf, .iconleaf2 {
width: 3px;
height: 5px;
background-position: -87px -41px;
}
.iconleaf {
left: 47px;
top: 11px;
}
.iconleaf2 {
left: 72px;
top: 10px;
}
.lmenu {
margin: 50px 200px;
width: 250px;
height: auto;
overflow: hidden;
font-family: Tahoma, Helvetica, "Microsoft Yahei", "微软雅黑", Arial,
STHeiti;
margin-bottom: 10px;
border: 1px solid #AEB1B5;
}
.lmenu ul li {
position: relative;
cursor: pointer;
}
.lmenu ul li span {
display: block;
width: 100%;
height: 28px;
line-height: 28px;
text-indent: 3em;
/*font-weight: bolder;*/
font-size: 14px;
color: #0E3E5E;
border-bottom: 1px solid #D7D7D7;
background-position: -46px 0;
}
.lmenu ul li ul li, .lmenu ul li ul li span {
background-color: #F7F8F8;
color: #333;
text-indent: 5em;
font-size: 13px;
height: auto;
line-height: 28px;
}
.lmenu ul li ul li span {
background: none;
}
.lmenu ul li ul li ul li {
border: none;
text-indent: 7em;
font-size: 12px;
font-weight: normal;
height: 24px;
line-height: 24px;
}
</style>
<body>
<div class="lmenu">
<ul>
<li><span>一级菜单</span>
<ul>
<li><span>基本</span>
<ul>
<li>全屏</li>
<li>源码</li>
</ul></li>
<li><span>格式化</span>
<ul>
<li>全生生死死屏</li>
<li>源码</li>
</ul></li>
<li>个性化配置</li>
</ul></li>
<li><span>2级菜单</span>
<ul>
<li>我是2级菜单下面的</li>
<li>我是2级菜单下面的</li>
<li>我是2级菜单下面的</li>
<li>我是2级菜单下面的</li>
</ul></li>
</ul>
</div>
</body>
<script type="text/javascript">
$(document).ready(function() {
/*一级菜单的样式*/
$(".lmenu > ul > li > span").prepend('<em class="icoclose"></em>');
/*二级菜单的样式*/
$(".lmenu > ul > li > ul > li").each(function() {
/*检查是否有节点*/
span = $(this).find("span");
if (span.length) {
span.prepend('<em class="icoclose2"></em>');
} else {
$(this).prepend('<em class="iconleaf"></em>')
}
});
/*三级菜单的样式*/
$(".lmenu > ul > li > ul > li > ul > li").click(function() {
alert($(this).text());
}).prepend('<em class="iconleaf2"></em>');
$(".lmenu ul li span").click(function() {
var ye = $(this).find('em');
classNama = ye.attr("class");
if (classNama == 'icoclose') {
ye.attr('class', 'icoopen');
} else if (classNama == 'icoopen') {
ye.attr('class', 'icoclose');
} else if (classNama == 'icoclose2') {
ye.attr('class', 'icoopen2');
} else if (classNama == 'icoopen2') {
ye.attr('class', 'icoclose2');
}
$(this).siblings("ul").slideToggle("normal", "swing");
});
});
</script>
</html>