Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript_howto thread: getKeyCode()


Message #1 by "payam" <torkian@c...> on Fri, 27 Dec 2002 12:10:05
Hello Payam,

In the following example I check that whether the entered key is a number or not and that it is greater than 0. If it is not the key
is rejected and nothing appears in the text area.

function Salam(myKey){
 varQty = myKey.value;
 if ((varQty < 1) || (isNaN(varQty))){
 alert("Please enter a valid number!") ;
 return false;
 }else{
 return true;
 }
}

I hope it helps.

Majid Qazi



----- Original Message ----- 
From: "payam" <torkian@c...>
To: "JavaScript HowTo" <javascript_howto@p...>
Sent: Friday, December 27, 2002 12:10 PM
Subject: [javascript_howto] getKeyCode()


> hello!
> I want my textarea to return me the code of the key anytime that I type a 
> char in it.
> what's your suggestion for SALAM function? :
>  <textarea onKeyDown=" SALAM ">
>  </textarea>
> 
> thanks

  Return to Index