«   2025/02   »
1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28
Archives
Today
Total
관리 메뉴

올해는 머신러닝이다.

img size 변경 관련 본문

Android/Tip&Tech

img size 변경 관련

행복한 수지아빠 2011. 3. 22. 13:18

<html>

<head>

<script type="text/javascript">


    function resize(image)

    {

        var differenceHeight = document.body.clientHeight - image.clientHeight;

        var differenceWidth  = document.body.clientWidth  - image.clientWidth;

        if (differenceHeight < 0) differenceHeight = differenceHeight * -1;

        if (differenceWidth  < 0) differenceWidth  = differenceWidth * -1;


        if (differenceHeight > differenceWidth)

        {

            image.style['height'] = document.body.clientHeight + 'px';

        }

        else

        {

            image.style['width'] = document.body.clientWidth + 'px';

        }


        // Optional: remove margins or compensate for offset.

        image.style['margin'] = 0;

        document.body.style['margin'] = 0;

    }


</script>


</head>

<body>


<img src="http://extremecnc.co.kr/board_data/z_product/1297766177_98262_8.jpg" onload="resize(this);" />


</body>

</html>