$(".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;
}
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);
}
}