﻿// JScript File
function digitOnly()
{
    /*
        When the key is pressed, we’re using the key’s ASCII value to check which button is pressed. 
        In first expression, delete, tab or backspace button is is checked and “8″ is the ASCII values of the Back-space. 
        Digits are checked in the second expression. “48″ is the ASCII values of “0″ and “57″ is 
        the ASCII values of “9″. The the ASCII values of the other digits lies between “48″ to “57″. 
        And, if the key pressed values doesn’t lies withing these range, 
        then do nothing;  
    */
    
    var key = window.event.keyCode;
    if (key != 8 && key != 0 && (key < 48 || key > 57))
    {
        window.event.returnValue = false;
    }
}

