![JavaScript等比例缩放图片](https://700zi.400zi.cn/uploadfile/img/14/592/fbfdba281553c478bf55705c3f8d6fe7.jpg)
web前端|js教程
JavaScript
web前端-js教程
js等比例缩放图片,这个功能非常实用,当网页加载一个尺寸比较大的图片时,往往会把一个网页撑的变形,页面变得很难看,于是我们就想到了用JS去控制超出一定范围的图片,以稳定页面布局,本代码段就是完成了此功能,而且代码非常简洁,效果很好。
ecshop商品采集的源码,ubuntu 跑分工具,配置tomcat7插件,爬虫python 同花顺,php瀑布流 分页,荆州seo关键词优化怎么样lzw
<html>
等比例缩放图片function DrawImage(ImgD,iwidth,iheight){ //参数(图片,允许的宽度,允许的高度) var image=new Image(); image.src=ImgD.src; if(image.width>0 && image.height>0){if(image.width/image.height>= iwidth/iheight){ if(image.width>iwidth){ImgD.width=iwidth; ImgD.height=(image.height*iwidth)/image.width; }else{ ImgD.width=image.width;ImgD.height=image.height; }}else{ if(image.height>iheight){ImgD.height=iheight; ImgD.width=(image.width*iheight)/image.height; }else{ ImgD.width=image.width;ImgD.height=image.height; }} } }
python php源码下载,ubuntu 查看驱动命令,两个tomcat注册服务,机械爬虫课件,php教程自我介绍,seo 学习费用lzw