鼠标滑过,换背景
1 ar box = document.getElementById("box"); 2 function fn(liid,bg){ // 封装函数 参数的传递 3 var obj = document.getElementById(liid); 4 obj.onmouseover = function(){ 5 box.style.backgroundImage = bg; 6 } 7 } 8 fn("li01","url(images/01big.jpg)"); // 实参 9 fn("li02","url(images/02big.jpg)"); 10 fn("li03","url(images/03big.jpg)");