请等待数据载入中...
Please wait until this screen is completely loaded.

风のBlog - 我的大杂烩

« 为减少垃圾评论添加了SCode | 首页 | SlideShowPro,一款以Flash为基础的相册 »

2006年07月30日

图片的相对自适应(JS版)

在<head>部位插入下面代码:

<script language="javascript">
function ReImgSize(){
for (j=0;j<document.images.length;j++)
{
document.images[j].width=(document.images[j].width>420)?"420":document.images[j].width;
}
}
</script>

在img标签中加上onload="ReImgSize()"就能完成图片的相对自适应,不过我用这方法的时候发现一个页面图片多的话图片的大小就乱七八糟了,不知是什么原因。

收藏此页到:365Key网摘   新浪VIVI   天极网摘   博采中心   YouNote网摘

Posted by luckywind at 2006年07月30日 傍晚08时21分 | English Version | Blog Home

Trackback Pings

TrackBack URL for this entry:
http://www.luckywind.net/cgi-bin/mt/mt-tb.cgi/546

Comments

Post a comment




Remember Me?



Copyright © O.CN, all rights reserved. 湘ICP备06007926号 
XHTML, CSS, 508, RDS, RSS 1.0, RSS 2.0, ATOM. Powered by Movable Type 3.33

我的邮箱:luckywind 网站地图 闲言碎语 游戏专区 新闻文章 推荐工具 技术新知 休闲娱乐 我的收藏 返回首页
风のBlog - 我的大杂烩 Articles catalogue

luckywind.net v 4_2