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

· 10년 전 · 298

<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년 전 조회 772
10년 전 조회 369
10년 전 조회 345
10년 전 조회 414
10년 전 조회 425
10년 전 조회 462
10년 전 조회 330
10년 전 조회 229
10년 전 조회 320
10년 전 조회 262
10년 전 조회 278
10년 전 조회 245
10년 전 조회 299
10년 전 조회 302
10년 전 조회 343
10년 전 조회 257
10년 전 조회 275
10년 전 조회 448
10년 전 조회 290
10년 전 조회 347
10년 전 조회 311
10년 전 조회 362
10년 전 조회 468
10년 전 조회 340
10년 전 조회 314