我有一个IMG 图片框  当鼠标左键就放大IMG 当鼠标右键就缩小.

解决方案 »

  1.   


    <body oncontextmenu="return false">
    <img src="http://profile.csdn.net/ning0917/picture/2.jpg" style="height:100;width:100" onmousedown="show(this)" onclick="leftDown(this)">
    <script language="javascript">
    function show(obj)
    {
    if(event.button==2){
    var objHeight=parseInt(obj.style.height)-parseInt(10)
    obj.style.height=(objHeight>0)?objHeight:0
    var objWidth=parseInt(obj.style.width)-parseInt(10)
    obj.style.width=(objWidth>0)?objWidth:0
    }
    }
    function leftDown(obj)
    {
    if(event.button==0){
    obj.style.height=parseInt(obj.style.height)+parseInt(10)
    obj.style.width=parseInt(obj.style.width)+parseInt(10)
    }
    }
    </script>
      

  2.   

    <img src="a.jpg" width="75" height="75" onclick="this.width='100';this.height='100'" 
    oncontextmenu="this.width='50';this.height='50';return false">