실제 이미지 크기 알아내기 입니다.

· 10년 전 · 232

<img src="xxx.jpg" onclick=how_size(this) title=이미지크기는얼마일까요 style=cursor:pointer>
 <script language=javascript>
function get_image_size(id) {
    img = document.body.appendChild(document.createElement('img'))
    img.src = id.src;
    var w = img.offsetWidth;
    var h = img.offsetHeight;
    document.body.removeChild(img);
    return {width:w,height:h};
}
function how_size(img) {
    var size = get_image_size(img);
    alert('width:'+size.width+',height:'+size.height);
}
</script>

|
댓글을 작성하시려면 로그인이 필요합니다.

팁게시판

디자인과 관련된 유용한 정보를 공유하세요. 질문은 상단의 QA에서 해주시기 바랍니다.

+
제목 글쓴이 날짜 조회
10년 전 조회 710
10년 전 조회 310
10년 전 조회 289
10년 전 조회 350
10년 전 조회 358
10년 전 조회 388
10년 전 조회 264
10년 전 조회 170
10년 전 조회 269
10년 전 조회 197
10년 전 조회 215
10년 전 조회 181
10년 전 조회 233
10년 전 조회 240
10년 전 조회 284
10년 전 조회 201
10년 전 조회 219
10년 전 조회 386
10년 전 조회 232
10년 전 조회 284
10년 전 조회 263
10년 전 조회 300
10년 전 조회 412
10년 전 조회 284
10년 전 조회 251
🐛 버그신고