Pranay Rana: Java Script for validation decimal number on key press event

Thursday, September 17, 2009

Java Script for validation decimal number on key press event

function CheckUnit(obj,event)
{

if ( event.keyCode == 8 event.keyCode ==46
event.keyCode == 37 event.keyCode ==39 )
{
event.returnValue = true;
return true;
}

if (((event.keyCode <> 57)) )
{
if (event.keyCode !=190)
{
event.returnValue = false;
return false;
}
}
if( (String.fromCharCode(event.keyCode)) =="¾")
{
var val = obj.value;

if(val.indexOf(".") > -1)
{
event.returnValue = false;
return false;
}
}

}



























5 comments:

  1. brinkka2011 says: Thanks so much for posting all of the good content! I am looking forward to reading more.

    ReplyDelete
  2. Cool blog as for me. Thnx for providing this information.

    Greg Writeman
    remote control jammer

    ReplyDelete
  3. Cool post to my mind. Thnx a lot for enlightning this info.

    Fill Phillsen
    milano escort accompagnatrici

    ReplyDelete
  4. Great info if you ask me. Thank u a lot for enlightning that data.

    Greg Phillsen
    london indian escort

    ReplyDelete
  5. Cool article if you ask me. Thnx for enlightning that info.

    Suissy Innou
    paphos escort agencies

    ReplyDelete