标题 | js等比例缩放图片 |
内容 | <script language="JavaScript"> <!-- var flag=false; function DrawImage(ImgD){ var image=new Image(); image.src=ImgD.src; if(image.width>0 && image.height>0){ flag=true; if(image.width/image.height>= 164/112){ if(image.width>164){ ImgD.width=164; ImgD.height=(image.height*164)/image.width; }else{ ImgD.width=image.width; ImgD.height=image.height; } //forasp ImgD.alt=image.width+"x"+image.height; } else{ if(image.height>112){ ImgD.height=112; ImgD.width=(image.width*112)/image.height; }else{ ImgD.width=image.width; ImgD.height=image.height; } ImgD.alt=image.width+"x"+image.height; } } } //--> </script> <a href="./img.jpg" target="_blank"><img src="5_1.jpg" width="164" height="112" onload="javascript:DrawImage(this);"></a> |
随便看 |
|
在线学习网考试资料包含高考、自考、专升本考试、人事考试、公务员考试、大学生村官考试、特岗教师招聘考试、事业单位招聘考试、企业人才招聘、银行招聘、教师招聘、农村信用社招聘、各类资格证书考试等各类考试资料。