이미지 크기 알아내자

<img src="xxx.jpg" onclick=how_size(this) title=이미지 style="cursor:pointer">

<script-x language=javascript-x>
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-x>

Press ESC to close