日期:2014-05-16  浏览次数:20347 次

卓越网的有一个效果怎么做出来的
把鼠标放到菜单 "所有20类商品 ",会出现一个渐渐放大的效果,我查了源代码,这个链接并没有onmouseover的事件,请教

------解决方案--------------------
链接可以有个ID如:aa
则可以用:
document.getElementById( 'aa ').onmouseover=自定义函数;//函数不能加括号
如:
<a id= "aa " href= " "> 试试 </a>
<script type= "text/javascript ">
function shi(){window.alert( 'OK ');}
document.getElementById( 'aa ').onmouseover=shi;
</script>
------解决方案--------------------
document.getElementById( 'aa ').onmouseover

好象和

<a id= "aa " href= " " onmouseover = "shi() "> 试试 </a>

这样没什么区别?


------解决方案--------------------
寫一個放大的(onclick),縮小的改一下就行。

<script type= "text/javascript ">
function resize(objid,w,offx,timeout){
var obj=document.getElementById(objid);
if(obj.offsetWidth <w){
obj.style.width=obj.offsetWidth+offx+ 'px ';
obj.style.height=obj.offsetHeight+offx+ 'px ';
setTimeout( 'resize(\ ' '+objid+ '\ ', '+w+ ', '+offx+ ', '+timeout+ ') ',timeout);
}
}
</script>
<div id= "zoom " style= "background-color:#000000;width:100px;height:100px; " onclick= "resize( 'zoom ',500,50,50); "> 此处显示 id "zoom " 的内容 </div>