:: Forum >>

How to fire a JS event when "Enter" key is pressed ?

Hi,

I want to invoke a JS function when "Enter" key is pressed ?

Using the onkeydown or keypress event will be a way but how to track the "Enter" key ?
BhanuPratap Mohariya
Tuesday, February 5, 2008
Use this code:-

<script language="javascript">
function keypress(e)
{
var Ucode=e.keyCode? e.keyCode : e.charCode
if (Ucode == 13)
{
//write the code for submit
AddChat(page);
}
}
</script>
***************************************
add this event on text box onkeypress="keypress(event);"

Regards
Vindesh Mohariya(Lowanshi)
mr.mohariya@gmail.com
Vindesh Mohariya(Lowanshi)
Tuesday, February 5, 2008

This topic is archived.


Back to support forum

Forum search