Sunday, July 8, 2012

Mouse Events Example In java Script

<html>
    <head>
        <title>Mouse Events Example</title>
        <script type="text/javascript">
            function handleEvent(oEvent) {
                var oTextbox = document.getElementById("txt1");
                oTextbox.value += "\n" + oEvent.type;
            }
        </script>
    </head>
    <body>
        <P>Use your mouse to click and double click the pink square.</p>
        <div style="width: 200px; height: 200px; background-color: pink"
             onmouseover="handleEvent(event)"
             onmouseout="handleEvent(event)"
             onmousedown="handleEvent(event)"
             onmouseup="handleEvent(event)"
             onclick="handleEvent(event)"
             ondblclick="handleEvent(event)" id="div1"></div>
        <P><textarea id="txt1" rows="35" cols="50"></textarea></p>
    </body>
</html>


Output :


No comments:

Post a Comment