惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
爱范儿
爱范儿
H
Help Net Security
V
Visual Studio Blog
J
Java Code Geeks
Stack Overflow Blog
Stack Overflow Blog
Microsoft Security Blog
Microsoft Security Blog
Apple Machine Learning Research
Apple Machine Learning Research
MyScale Blog
MyScale Blog
The Cloudflare Blog
Martin Fowler
Martin Fowler
D
Docker
腾讯CDC
F
Fortinet All Blogs
雷峰网
雷峰网
GbyAI
GbyAI
G
Google Developers Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Recent Announcements
Recent Announcements
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Blog — PlanetScale
Blog — PlanetScale
Engineering at Meta
Engineering at Meta
博客园 - 聂微东
博客园 - 叶小钗

博客园 - 自由.Net

转-支付宝Payto接口的c#.net实现 ASP.NET(C#)利用QQ的IP数据库QQWry.Dat进行精确IP查询 菜鸟到高手:SQL开发进阶常用精妙语句 自动生成html文件 Pinging ? with 32 bytes of data 如何获取自增长列(标识列)的ID,并写入另一张表(多对多关系插入数据示例) 虚拟主机下asp.net 2.0的导航控件treeview,menu等出错 - 自由.Net - 博客园 在GridView帮定数据时把太长的字段替换成"...." 数据库中id大于1时帮定到Gridview上显示为红色 - 自由.Net - 博客园 SQl 使自增字段清零 asp.net 2.0 下设置和使用FCKeditor文本编辑器 Asp.net 数据采集基类(远程抓取,分解,保存,匹配) PayPal支付接口 asp.net 2.0中判断上传的图片是否符合规格 DataSet接收XML数据并按条件搜索 我的asp.net程序当前占用了多少内存? [Asp.Net]按字符串实际长度截取定长字符窜 DataBinding绑定表达式: 验证用户名必须以字母打头且不能含有中文 加密,解密Web.Config
一段javascript实现缩略图的好代码 - 自由.Net - 博客园
自由.Net · 2008-06-19 · via 博客园 - 自由.Net

一段javascript实现缩略图的好代码,可以实现缩略图,代码如下
<script  language="javascript">

//显示缩略图
function DrawImage(ImgD,width_s,height_s){
/*var width_s=139;
var height_s=104;
*/
var image=new Image();
image.src=ImgD.src;
if(image.width>0 && image.height>0){
flag=true;
if(image.width/image.height>=width_s/height_s){
if(image.width>width_s){
ImgD.width=width_s;
ImgD.height=(image.height*width_s)/image.width;
}else{
ImgD.width=image.width;
ImgD.height=image.height;
}
}
else{
if(image.height>height_s){
ImgD.height=height_s;
ImgD.width=(image.width*height_s)/image.height;
}else{
ImgD.width=image.width;
ImgD.height=image.height;
}
}
}
/*else{
ImgD.src="";
ImgD.alt=""
}*/
}
</script>

调用时,很简单,比如一段ASP代码的
<img src="../memberphoto/<%=rs("picpath")%>" align="center" onload="DrawImage(this,200,200)"></div>