Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Dec 2005
    Location
    São Paulo, Brasil
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Only numbers - critical

    Hi,

    Somebody can help me with a function about "only number"?

    I need to find a function that doesn't allows the user informs numbers.



    William
    Tks
    William

  • #2
    Senior Coder
    Join Date
    Apr 2005
    Posts
    1,051
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by willjs View Post
    Hi,

    Somebody can help me with a function about "only number"?

    I need to find a function that doesn't allows the user informs numbers.



    William
    First, word your question better.

    Second, you should post anything you have already attempted.

    http://www.codingforums.com/postguide.htm

    Code:
    function onlyNumbers(frmInput)
    {
    	var re = new RegExp(/^[0-9]*$/); // regex to match only numbers
    					// note this regex will not match decimal values.
    	if(frmInput.Value.match(re))
    	{
    		alert('invalid input');
    	}
    	alert('valid input');
    }
    public string ConjunctionJunction(string words, string phrases, string clauses)
    {
    return (String)(words + phrases + clauses);
    }
    <--- Was I Helpfull? Let me know ---<

  • #3
    Regular Coder
    Join Date
    Oct 2004
    Posts
    168
    Thanks
    0
    Thanked 5 Times in 5 Posts
    You can use the Is-Not-A-Number function :

    Code:
    if(isNaN(myVar))
    {
        alert("Not a number");
    }
    else
    {
        alert("Is a number");
    }

  • #4
    New Coder
    Join Date
    Dec 2005
    Location
    São Paulo, Brasil
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Sorry!

    I go to post my questions better!

    Thanks
    William
    Tks
    William


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •