自动缩略图JS
发布日期:2022-02-01 14:28:22 浏览次数:40 分类:技术文章

本文共 1181 字,大约阅读时间需要 3 分钟。

<script  language="JavaScript">  <!--  function  DrawImage(ImgD,width,height){       var  image=new  Image();       image.src=ImgD.src;       if(image.width>0  &&  image.height>0){         if(image.width/image.height>=  width/height){           if(image.width>width){               ImgD.width=width;           ImgD.height=(image.height*width)/image.width;           }else{           ImgD.width=image.width;               ImgD.height=image.height;           }           }         else{           if(image.height>height){         ImgD.height=height;           ImgD.width=(image.width*height)/image.height;                     }else{           ImgD.width=image.width;               ImgD.height=image.height;           }           }         }  }  function fiximgwin(url){var imgwin=window.open('','img','width=50,height=50')imgwin.focus()var HTML="<html>/r/n<head>/r/n<title>图片浏览</title>/r/n</head>/r/n<body leftmargin=/"0/" topmargin=/"0/">/r/n<img src=/""+url+"/" οnlοad=/"window.resizeTo(this.width+10,this.height+50);window.moveTo((screen.width-this.width)/2,(screen.height-this.height)/2)/">/r/n</body>/r/n</html>"var doc=imgwin.documentdoc.open("text/html","replace")doc.write(HTML)doc.close()}//-->  </script>

<img src="upload/200672238047609.jpg" border="0" width="170" height="200" οnlοad="javascript:DrawImage(this,170,200);" alt="点击看大图"  style="cursor:hand" οnclick="fiximgwin('upload/200672238057609.jpg');">

转载地址:https://blog.csdn.net/shunzi110/article/details/1073572 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!

上一篇:如何使用反射创建类对象、构造方法、调用方法和属性等
下一篇:window.open 详解

发表评论

最新留言

初次前来,多多关照!
[***.217.46.12]2024年04月11日 19时26分06秒