X龙@China .Net 'blog

需要的不仅仅是工作,而是通过努力得来的美好将来。
  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

js下拉菜单(静态)

Posted on 2010-01-22 09:50  X龙  阅读(313)  评论(0编辑  收藏  举报

下拉菜单为静态内容,并且已经定位好相应元素的位置。

代码
ById = function(id) {
    
var Obj = document.getElementById(id);
    Obj.onmouseover 
= function() {
        
for (var i = 0; i < this.childNodes.length; i++) {
            
var tobj = this.childNodes[i];
            
if (tobj.nodeType == 1) {
                
if (tobj.style.display == 'none' && tobj.className == 'imsc') {
                    tobj.style.display 
= 'block';
                }
            }
        }
    }
    Obj.onmouseout 
= function() {
        
for (var i = 0; i < this.childNodes.length; i++) {
            
var tobj = this.childNodes[i];
            
if (tobj.nodeType == 1) {
                
if (tobj.style.display == 'block' && tobj.className == 'imsc') {
                    tobj.style.display 
= 'none';
                }
            }
        }
    }
}

ById(
'nav-commeBuy');


点击这里给我发消息http://wp.qq.com/index.html