照着打的js文件却没效果出来??
function bind(el,eventType, callback){ if(typeof el.addEventListener === "function"){ el.addEventListener(el,eventType, callback,false); }else if(typeof el.attechEvent === "function"){ el.attechEvent("on" + eventType,callback); } } function mouseoverHandler(e){ var target = e.target || e.srcElement; var outer = document.getElementById("subject"); var list = outer.getElementsByTagName("li"); for(var i=0; i<list.length; i++){ list[i].className = ""; } while(target.tagName != "LI" && target.tagName == "body"){ target = targt.parentNode; } target.className = "big"; } function initList(){ var outer = document.getElementById("subject"); var list = outer.getElementsByTagName("li"); for(var i=0; i<list.length; i++){ bind(list[i],"mouseover", mouseoverHandler); } } initList();
然后HTML文件中引用就是这样子:
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <link rel="stylesheet" type="text/css" href="index.css"> <title>手风琴效果</title> <script type="text/javascript" src="index.js"></script> </head> <body> 省略…… </body> </html>
监听和缩放的效果都没有出来,为什么