利用java生成微缩图。网上有这种插件的

解决方案 »

  1.   

    即图片预览
    写了一个限定为300*300的图片缩小预览
    <script>
    function show(i)
    {
    preview.document.all.imgpre.style.width='';
    preview.document.all.imgpre.style.height='';
    preview.document.all.imgpre.src=i+'.jpg';
    }
    </script>
    <a href='javascript:void(0)' onclick="show(1)">pic1</a>
    <br>
    <a href='javascript:void(0)' onclick="show(2)">pic2</a>
    <br>
    <a href='javascript:void(0)' onclick="show(3)">pic3</a>
    <br>
    <iframe id=preview style="width:300;height:300;" src=preview.htm></iframe>preview.htm
    <script>
    function myresize(obj)
    {
    topsize=top.document.all.preview.style.pixelWidth;
    if(obj.clientWidth>=obj.clientHeight)
    {
    max=obj.clientWidth;
    if(max>topsize)
    {
    obj.style.height=topsize/max*obj.clientHeight;
    obj.style.width=topsize;
    }
    }
    else
    {
    max=obj.clientHeight;
    if(max>topsize)
    {
    obj.style.width=topsize/max*obj.clientWidth;
    obj.style.height=topsize;
    }
    }
    }
    </script>
    <body scroll="no" leftmargin="0" topmargin="0">
    <img id=imgpre src='' onload=myresize(this)>