Play Flash Games


© 2007 Red Computer

HTML Howto, CSS Howto, JavaScript Howto, PHP Howto, Windows Howto
Google

Detect The Enter Key


This example will show how to detect if the user presses the Enter key in a text area. :

<script type="text/javascript">
function detectKey() {
    if (event.keyCode==13) { 
	    alert("Enter key has been pressed !");
	}
}
</script>

Type characters and press Enter key :<br>
<form>
    <textarea cols=50 rows=2 onkeypress="detectKey()"></textarea>
</form>

This is the result :
Type characters and press Enter key :





Visitor's Comment
Comment no. 2





From Date 31/01/50 Time 10.37 [61.17.70.179]
Comment no. 3
This is the lamest code ever.
From Date 20/02/50 Time 02.03 [206.171.223.152]
Comment no. 4
WTF. This code is gay don't even work. get rid of it.
From Shane Date 26/02/50 Time 07.08 [203.26.206.129:203.122.249.48:203.122.249.48]
Comment no. 4

From Date 07/08/50 Time 16.18 [61.17.200.210]
Comment no. 5
kjnk
;lk;lk
From kl; Date 09/08/50 Time 13.46 [59.92.110.173:192.168.0.3:192.168.0.3]
Comment no. 6



From Date 02/09/50 Time 04.59 [212.70.210.74]
Comment no. 8
this code is not working
From senthil Date 15/10/50 Time 12.04 [122.167.92.88]
Comment no. 8
sd
2
3
4
4

From test Date 14/08/51 Time 11.44 [124.121.151.48]
Comment no. 9
1.
2.
.3

From sdf Date 14/08/51 Time 12.06 [124.121.147.91]
Comment no. 10
dasd
From asd Date 02/09/51 Time 10.54 [119.95.71.177]
Comment no. 11
asd

asdasd
From asd Date 02/09/51 Time 10.55 [119.95.71.177]
Comment no. 12
not working in Firefox
From Date 02/10/51 Time 22.07 [69.77.177.163]

Post a Comment
Comment
Name :
E-mail :

HOME | HTML | CSS | JavaScript | PHP | XML | SQL | Virus Fix | Windows | Downloads | Links