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

· 10년 전 · 289

<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년 전 조회 765
10년 전 조회 362
10년 전 조회 337
10년 전 조회 407
10년 전 조회 415
10년 전 조회 450
10년 전 조회 320
10년 전 조회 219
10년 전 조회 312
10년 전 조회 255
10년 전 조회 269
10년 전 조회 235
10년 전 조회 290
10년 전 조회 292
10년 전 조회 336
10년 전 조회 249
10년 전 조회 263
10년 전 조회 442
10년 전 조회 284
10년 전 조회 339
10년 전 조회 303
10년 전 조회 354
10년 전 조회 461
10년 전 조회 334
10년 전 조회 305