下拉菜单为静态内容,并且已经定位好相应元素的位置。
代码
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');
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');