OnKeyDown

OnKeyDown event can be used to trigger JavaScript code.
Object.onKeyDown="execute function or code"
Inside an tag or element
onkeyDown="execute_function()";

Demo onkeydown
Like onkeypress event demo here also one one char less will be copied.
<html>
<head>
<title>Demo of on onkeyDown events in Javascript</title>
<script language=JavaScript>
<!--
function copy()
{
document.getElementById("t2").value=document.getElementById("t1").value;
}
//-->
</script>

</head>
<body>
<form name=my_form method=post>
What ever you type here 
<input  type=text id=t1 name=text onKeyDown=copy();> 
(Type minimum two chars)<br><br> will be copied to below textarea. <br>
<textarea id=t2   name=my_text rows=4 cols=30></textarea></form>
<br>
</body>
</html>

Detecting which arrow key is pressed by onkeydown event

onKeyUp Mouse event
Event Handling
Subscribe to our YouTube Channel here


Subscribe

* indicates required
Subscribe to plus2net

    plus2net.com










    We use cookies to improve your browsing experience. . Learn more
    HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
    ©2000-2024 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer