자동이미지크기조절

<script language='javascript'>
function a(name){
w = eval("document."+name+".width");
h = eval("document."+name+".height");

maxWidth = 300; // 출력 최대이미지 가로. 이곳의 숫자를 고치세요.
maxHeight = 300; // 출력 최대 이미지 세로 . 이곳의 숫자를 고치세요.

if(w > maxWidth || h > maxHeight){
if(w > h){
nw = maxWidth;
nh = Math.round((h*nw)/w);
}else{
nh = maxHeight;
nw = Math.round((nh*w)/h);
}
}else{
nw = w;
nh = h;
}

eval("document."+name+".height="+nh);
eval("document."+name+".width="+nw);
}
</script>

<img src='http://www.happycgi.com/Attach/screen_shot/2004/08/13/b-1092371586-happycgi.jpg' name='aaaa' id='aaaa' onload='a("aaaa")'>
|

댓글 1개

&&nbsp;&nbsp;
21년 전
특이한 스크립트군요.........^^
댓글을 작성하시려면 로그인이 필요합니다. 로그인

그누3 팁자료실

+
제목 글쓴이 날짜 조회
21년 전 조회 4,044
21년 전 조회 2,186
21년 전 조회 2,360
21년 전 조회 2,306
21년 전 조회 2,109
21년 전 조회 4,928
21년 전 조회 2,216
21년 전 조회 2,398
21년 전 조회 3,502
21년 전 조회 2,724
21년 전 조회 2,040
21년 전 조회 3,044
21년 전 조회 2,902
21년 전 조회 3,703
21년 전 조회 2,078
21년 전 조회 2,327
21년 전 조회 3,081
21년 전 조회 2,521
21년 전 조회 2,533
21년 전 조회 2,247
🐛 버그신고