Web/Javascript

이벤트

aucd29 2013. 9. 26. 21:29
<script language="javascript">
window.resizeTo(341,469);
</script>
<HTML>
<HEAD>
<TITLE>Smilee retertertertert</TITLE>
<script>
document.onmousemove = moveWIN;
drag = 0;
ofx = 2;
ofy = 21;
function moveWIN()
{
    if(drag == 1)
    {
        px = event.screenX - ofx - 1;
        py = event.screenY - ofy - 1;
        top.window.moveTo(px , py);
    }
}

function chmode()
{
    if (event.button==2)
    {
        window.close();
    }

    if(drag == 0)
    {
        document.image.state.value = 'DRAG'
        drag = 1;
        ofx = event.x + 2;            
        ofy = event.y + 21;
    }
    else
    {
        document.image.state.value = 'STOP'
        drag = 0;
        ofx = 2;            
        ofy = 21;
    }
}
</script>     
</HEAD>
<body topmargin='0' leftmargin='0' marginwidth='0' marginheight='0'>
<table border='0' cellspacing='0' cellpadding='0'>
<form name=image><input type="hidden" name="PHPSESSID" value="9238a748a80c433a887bb6e26bc71c8e" />
    <tr height=20 bgcolor=black style="font-size:12">
        <td><font color=white><b>MODE : </b><input type="text" name="state" style="border-style:none;background-color:black;color:white;" value="STOP" size=10> 클릭하면 드래그 됩니다.</font></td>
    </tr>
    <tr>
        <td>
        <img src='photo/flower_13.jpg' border='0' onmousedown="chmode()" alt="왼쪽클릭 : 드래그, 오른쪽클릭 : 닫기"></td>
    </tr>
</form>
</table>
</BODY>
</HTML>