我是做下拉菜单功能来的。。
hide:function (i,evt) {
e= evt || window.event;
e.relatedTarget=e.relatedTarget || e.toElement;
if(e.relatedTarget ==nvaDiv[i]){
return;
}
this.nvaDiv[i].style.display="none";
}
}
我鼠标移动出判断是移出在那个对象上。。为什么我这样
e.relatedTarget=e.relatedTarget || e.toElement;
标准化不了哈。。就卡在这里功能就完成了!全部JS代码
window.onload=function () {
function menu(nva,nvaDiv){
this.nva=nva;
this.nvaDiv=nvaDiv;
var _this=this;
for(var i=0;i<nva.length;i++){
hai(i,_this);
}
}function hai(i,_this){
nva[i].onmouseover=function () {
_this.show(i);
};
nva[i].onmouseout=function (evt) {
_this.hide(i,evt);
};
nvaDiv[i].onmouseout=function (evt){
_this.hide(i,evt);
};
}
menu.prototype={
show:function (i) {
this.nvaDiv[i].style.display="block";
},
hide:function (i,evt) {
e= evt || window.event;
e.relatedTarget=e.relatedTarget || e.toElement;
if(e.relatedTarget ==nvaDiv[i]){
return;
}
this.nvaDiv[i].style.display="none";
}
}//获取li里的a
var nva=document.getElementById("show").getElementsByTagName("a");
//获取li里的a的div
var nvaDiv=document.getElementById("show").getElementsByTagName("div");
var m=new menu(nva,nvaDiv);};
hide:function (i,evt) {
e= evt || window.event;
e.relatedTarget=e.relatedTarget || e.toElement;
if(e.relatedTarget ==nvaDiv[i]){
return;
}
this.nvaDiv[i].style.display="none";
}
}
我鼠标移动出判断是移出在那个对象上。。为什么我这样
e.relatedTarget=e.relatedTarget || e.toElement;
标准化不了哈。。就卡在这里功能就完成了!全部JS代码
window.onload=function () {
function menu(nva,nvaDiv){
this.nva=nva;
this.nvaDiv=nvaDiv;
var _this=this;
for(var i=0;i<nva.length;i++){
hai(i,_this);
}
}function hai(i,_this){
nva[i].onmouseover=function () {
_this.show(i);
};
nva[i].onmouseout=function (evt) {
_this.hide(i,evt);
};
nvaDiv[i].onmouseout=function (evt){
_this.hide(i,evt);
};
}
menu.prototype={
show:function (i) {
this.nvaDiv[i].style.display="block";
},
hide:function (i,evt) {
e= evt || window.event;
e.relatedTarget=e.relatedTarget || e.toElement;
if(e.relatedTarget ==nvaDiv[i]){
return;
}
this.nvaDiv[i].style.display="none";
}
}//获取li里的a
var nva=document.getElementById("show").getElementsByTagName("a");
//获取li里的a的div
var nvaDiv=document.getElementById("show").getElementsByTagName("div");
var m=new menu(nva,nvaDiv);};
解决方案 »
- js首页导航 部分浏览器无法正常使用
- 在线编译器如何实现插入图片功能?
- 我提交评论后由于评论在最下边,提交之后页面,页面刷新之后,如何滚动到我发表的评论的位置那,
- 在struts中,下拉框如果onChange,就触发一个action,怎么实现,各位大哥!!!
- 为什么不显示?错在哪?
- javascript计算时间差的问题?-紧急求助
- 如何让一个页面所有的控件一下子都不可操作?
- 各位大哥!请问手动对一个字符串(中文)进行URL编码的JAVASCRIPT语句怎么写?
- net_lover,你的《在网页中调用本地的应用程序》为什么不能执行呢????
- 类BBS评论的回复功能怎么实现
- Ext Tree 在开启拖拽的情况下如何取消拖拽
- javascript 能否异步调用其他页面的javascript方法
if(event.type=="mouseout")//好像是mouseout跟mouseover事件不太一样的问题
event.relatedTarget=event.toElement;
else if(event.type=="mouseover")
event.relatedTarget=event.fromElement;
var ee=e.relatedTarget || e.toElement;