您的位置:首页 > 其它

网页载入过程中自动调整图片的宽度

2012-08-02 15:04 197 查看
01
<
html
>
02
<
head
>
03
<
meta
http-equiv
=
"Content-Type"
content
=
"text/html;
charset=utf-8"
/>
04
<
title
>网页载入过程中自动调整图片的宽度</
title
>
05
</
head
>
06
07
<
body
>
08
<
script
language
=
"javascript"
>
09
var
flag=false;
10
function
DrawImage(ckp){
11
var
image=new Image();
12
image.src=ckp.src;
13
if(image.width>0
&& image.height>0){
14
flag=true;
15
if(image.width>120){
16
ckp.width=120;
17
}else{
18
ckp.width=image.width;
19
}
20
ckp.alt=image.width+"×"+image.height;
21
}
22
}
23
</
script
>
24
25
<
img
src
=
"http://www.phpernote.com/images/logo.gif"
border
=
"0"
onload
=
"javascript:DrawImage(this);"
>
26
</
body
>
27
</
html
>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: