放大10%:
imgElement.width = imgElement.offsetWidth * 1.10

解决方案 »

  1.   

    用javaSript 怎么实现呢?不好意思啊,我还是不懂得。你上边写的代码该如何来运用。能不能给一个具体的例子呢?
    拜托大家了。我刚开始学,请多多指教。
      

  2.   

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <HTML>
    <HEAD>
    <TITLE> New Document </TITLE>
    <meta http-equiv="content-type" content="text/html" charset="utf-8">
    <link rel="stylesheet" type="text/css" href="">
    <script type="text/javascript" src=""></script>
    <script language="javascript" type="text/javascript">

    function enlarge(id)
    {
    var node = document.getElementById(id);
    var width = node.getAttribute("width");
    var height = node.getAttribute("height");
    node.setAttribute("width",width+10);
    node.setAttribute("height",height+10);
    } function shrink(id)
    {
    var node = document.getElementById(id);
    var width = node.getAttribute("width");
    var height = node.getAttribute("height");
    node.setAttribute("width",width-10);
    node.setAttribute("height",height-10);
    }
    </script>
    </HEAD><BODY>
    <button onclick="enlarge('image');return true;">放大</button><button onclick="shrink('image');return true;">缩小</button><br/><br/>
    <img id="image" src="./image/image1.gif"><!--准备一张图片,路径自己把握-->
    </BODY>
    </HTML>
    lucky around U.
      

  3.   

    这个只能针对一张固定的图片。如果我图片的路径是通过后台servlet来获取:
    显示图片的jsp如下:
    <img src="../<%=imageInfo.getImageURL()%>" width="<%=imageInfo.getImageWidth()%>" height="<%=imageInfo.getImageHeight()%>"/>触发servlet的jsp如下:
    <input type="image" src="icon/EnlargeNormal.gif" alt="拡大通常" onclick="">
    <input type="image" src="icon/ReduceNormal.gif" alt="縮小通常" onclick="">
    我该如何写onclick=""?
      

  4.   

    看看我的网站,http://www.sgbuy.net 里产品大图的观看!用javascript实现的。感觉好的话,说声。呵呵!