想用JS做一个压缩文件的JSP页面!!希望能压缩到20K以内!希望各位大侠给小弟一些代码!!!!

解决方案 »

  1.   

    压缩jsp可以用去掉空白的方法,哪些js框架都是这种压缩方式把代码压成一行或几行!
    示例:
    http://dean.edwards.name/packer/你问的是js压缩图片没有用过!DC围观一下
      

  2.   

    等比例压缩行不
     <script type="text/javascript">
    function DrawImage(ImgD,FitWidth,FitHeight) 

    var image=new Image(); 
    image.src=ImgD.src; 
    if(image.width>0 && image.height>0) 

       if(image.width/image.height>= FitWidth/FitHeight) 
       { 
        if(image.width>FitWidth) 
        { 
         ImgD.width=FitWidth; 
         ImgD.height=(image.height*FitWidth)/image.width; 
        } 
        else 
        { 
         ImgD.width=image.width; 
         ImgD.height=image.height; 
        } 
       } 
        else 
        { 
        if(image.height>FitHeight) 
        { 
         ImgD.height=FitHeight; 
         ImgD.width=(image.width*FitHeight)/image.height; 
        } 
        else 
        { 
         ImgD.width=image.width; 
         ImgD.height=image.height; 
        } 
        } 

    } </script>onload="javascript:DrawImage(this,140,125);"
      

  3.   

    没看懂,到底是准备用js来做还是jsp来做?
    js是做不到的.
      

  4.   

    能用JSP做也行啊!只要能在客户端把图片进行压缩,压缩后再上传到服务器上!!!!!
      

  5.   

    JS对Image是无法操作的,行不通。考虑其他方法吧。
      

  6.   


    JavaScript 绘图框架 http://www.liquidx.net/plotkit/