Pass key event as the function parameter : Event Parameter « Event « JavaScript Tutorial






<html>
    <head>
        <title>Key Events Example</title>
        <script type="text/javascript">
            function handleEvent(oEvent) {
                var oTextbox = document.getElementById("txt1");
                oTextbox.value += "\n>" + oEvent.type;
            }
        </script>
    </head>
    <body>
        <P>Type some characters into the first textbox.</p>
        <P><textarea id="txtInput" rows="15" cols="50"
            onkeydown="handleEvent(event)"
            onkeyup="handleEvent(event)"
            onkeypress="handleEvent(event)"></textarea></p>
        <P><textarea id="txt1" rows="15" cols="50"></textarea></p>
    </body>
</html>








15.2.Event Parameter
15.2.1.Pass key event as the function parameter
15.2.2.Use mouse event as the function parameter
15.2.3.X/Y Marks the Spot for a popup window (IE)
15.2.4.Get event Phase: CAPTURING,BUBBLING