易截截图软件、单文件、免安装、纯绿色、仅160KB

JavaScript 多级菜单

 实现效果:
引入JS和CSS文件:
<mce:script type='text/javascript' src="dropdown/jquery-1.2.3.min.js" mce_src="dropdown/jquery-1.2.3.min.js"></mce:script>
<mce:script type='text/javascript' src="dropdown/menu.js" mce_src="dropdown/menu.js"></mce:script>
<link rel="stylesheet" href="dropdown/style.css" mce_href="dropdown/style.css" type="text/css" media="screen" />
style.css Code:
body{
font-size:0.85em;
font-family:Verdana, Arial, Helvetica, sans-serif;
}
#div{
line-height:1.5em;
list-style-type: none;
width: 300px;
margin-right: auto;
margin-left: auto;
}
#nav, #nav ul{
margin:0;
padding:0;
list-style-type:none;
list-style-position:outside;
position:relative;
line-height:1.5em;
}
#nav a{
display:block;
padding:0px 5px;
border:1px solid #333;
color:#fff;
text-decoration:none;
background-color:#333;
}
#nav a:hover{
background-color:#fff;
color:#333;
}
#nav li{
float:left;
position:relative;
}
#nav ul {
position:absolute;
display:none;
width:3em;
top:1.5em;
}
#nav li ul a{
width:10em; /*控制父菜单弹出菜单宽度*/
height:auto;
float:left;
}
#nav ul ul{
top:auto;
}
#nav li ul ul {
left:10em;
margin:0px 0 0 10px;
}
#nav li:hover ul ul, #nav li:hover ul ul ul, #nav li:hover ul ul ul ul{
display:none;
}
#nav li:hover ul, #nav li li:hover ul, #nav li li li:hover ul, #nav li li li li:hover ul{
display:block;
}
menu.js Code:
function mainmenu(){
$(" #nav ul ").css({display: "none"}); // Opera Fix
$(" #nav li").hover(function(){
$(this).find('ul:first').css({visibility: "visible",display: "none"}).show(400);
},function(){
$(this).find('ul:first').css({visibility: "hidden"});
});
}

$(document).ready(function(){
mainmenu();
});
<div id="div">
<ul id="nav" >
<li><a href="#" mce_href="#">ASP.NET</a>
<ul>
<li><a href="#" mce_href="#">ASP.NET AJAX</a></l


相关文档:

JavaScript 获取对象的高度和宽度详细说明

scrollHeight: 获取对象的滚动高度。
scrollLeft:设置或获取位于对象左边界和窗口中目前可见内容的最左端之间的距离
scrollTop:设置或获取位于对象最顶端和窗口中可见内容的最顶端之间的距离
scrollWidth:获取对象的滚动宽度
offsetHeight:获取对象相对于版面或由父坐标 offsetParent 属性指定的父坐标的高度
offsetL ......

javascript学习继续

 学习了解了javascript的一些元素对象的创建,获取等。现在的学习主要是涉及在编写javascript当中应该注意的一些细节:
1 注意变量的编写正确
2 参数传递出现问题 或者不存在也会导致出错
3 js错误的控制函数 window.onerror:其将会带三个参数信息 可通过参数数组 arguments 获取信息 错误信息,错误页面的url和错 ......

《JavaScript And DHTML Cookbook》学习笔记

  此文为读《JavaScript And DHTML Cookbook》后总结出来的笔记。由于当时是初学,所以笔记中难免有错误,欢迎指正。谢谢!
·字符串(String)
  1.声明
    var myString = new String("Every good boy does fine.");
    var myString = "Every good boy does fine.";
&n ......

javascript获取select的值全解

获取显示的汉字
document.getElementById("bigclass").options[window.document.getElementById("bigclass").selectedIndex].text
获取数据库中的id
window.document.getElementById("bigclass").value
获取select组分配的索引id
window.document.getElementById("bigclass").selectedIndex
例子:
<select name= ......

javascript 截取字符串

 1.substring 方法
定义和用法
substring 方法用于提取字符串中介于两个指定下标之间的字符。
语法
stringObject.substring(start,stop)
参数 描述
start 必需。一个非负的整数,规定要提取的子串的第一个字符在 stringObject 中的位置。
stop 可选。一个非负的整数,比要提取的子串的最后一个字符 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号