Sunday, 5 June 2016

Implement a Javascript Program that to displays an integer value as weight.If needed only 1 decimal point is allowed

Implement a Javascript Program that to displays an integer value as weight.If needed only 1 decimal point is allowed


For More Java Script Programs   Seo Veerendra


<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script>    
        function isNumber(eventValue)
        {
            //debugger;
            var asciiValue = eventValue.which ? eventValue.which : eventValue.keyCode;
            if ((asciiValue >= 48 && asciiValue <= 57) || (asciiValue == 46)) {                
            if (document.getElementById('txtWeight').value.indexOf('.') > 0 && (asciiValue == 46))
                    return false;
                else
                return true;
            }
            else
                return false;               
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <table>
            <tr>
                <td>Enter Number</td>
                <td><asp:TextBox ID="txtWeight" runat="server" onkeypress="return isNumber(event)"></asp:TextBox></td>
            </tr>
        </table>
    </div>
    </form>
</body>
</html>


For More Java Script Programs   Seo Veerendra

No comments :

Post a Comment