list[i].onmouseover=function(){
for(var i=0;i<list.length;i++)
{list[i].className=''; }
this.className='big';}}}
for(var i=0;i<list.length;i++)
{list[i].className=''; }
this.className='big';}}}
2016-08-21
$(".li").mouseover(function(){
$(this).toggleClass("big").siblings(".aa").removeClass("big");
});
$(this).toggleClass("big").siblings(".aa").removeClass("big");
});
2016-08-21
//鼠标悬停的处理函数
function mouseoverHandler(e){
var target = e.target||e.srcElement;
var outer = document.getElementById('imageMenu');
var list = outer.getElementsByTagName('li');
//根据事件的冒泡原理,找到需要变更class 的LI元素
while(target.tagName != 'LI' || target.tagName == 'BODY'){
target = target.parentNode;
}
function mouseoverHandler(e){
var target = e.target||e.srcElement;
var outer = document.getElementById('imageMenu');
var list = outer.getElementsByTagName('li');
//根据事件的冒泡原理,找到需要变更class 的LI元素
while(target.tagName != 'LI' || target.tagName == 'BODY'){
target = target.parentNode;
}
最新回答 / 飞天意大利面神兽
区别不大,只是opacity要单独给背景色。但如果使用了<...code...>那么兼容性上要比RGBA强,RGBA最多兼容到IE9,而这句代码可以兼容IE8或更早
2016-08-19
var oDiv=document.getElementById('demo');
var aLi=oDiv.getElementsByTagName('li');
for (var i = 0; i < aLi.length; i++) {
aLi[i].className='';
aLi[i].onmouseover=function(){
this.className='big';
}
aLi[i].onmouseout=function(){
this.className=' ';
}
}
var aLi=oDiv.getElementsByTagName('li');
for (var i = 0; i < aLi.length; i++) {
aLi[i].className='';
aLi[i].onmouseover=function(){
this.className='big';
}
aLi[i].onmouseout=function(){
this.className=' ';
}
}
2016-08-17
function bind(el, eventType, callback){
if(typeof el.addEventListener === 'function'){
//标准事件绑定方法
el.addEventListener(eventType, callback, false);
}else if(typeof el.attechEvent === 'function'){
//IE事件绑定方法
el.attachEvent('on' + eventType, callback);
}
}
if(typeof el.addEventListener === 'function'){
//标准事件绑定方法
el.addEventListener(eventType, callback, false);
}else if(typeof el.attechEvent === 'function'){
//IE事件绑定方法
el.attachEvent('on' + eventType, callback);
}
}