want to replace a-z character with space.

Discussion in 'JavaScript' started by KRISHNA KUMAR, Apr 12, 2009.

  1. #1
    i am making a calulator. i want when a user input any charater (a-z) it will replace with zero. it it's effect will show on result. and when user enter numeric value then it display with its results.

    thank's
     
    KRISHNA KUMAR, Apr 12, 2009 IP
  2. xlcho

    xlcho Guest

    Messages:
    532
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #2
    You can use this:
    <input type='text' value='' onkeyup="this.value = this.value.replace(/[a-z]/ig, '')">
    Code (markup):
    You must also think about other inacceptable characters like '^', '&', etc.
     
    xlcho, Apr 13, 2009 IP
  3. JavaScriptBank.com

    JavaScriptBank.com Peon

    Messages:
    141
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #3
    JavaScriptBank.com, Apr 13, 2009 IP
  4. KRISHNA KUMAR

    KRISHNA KUMAR Peon

    Messages:
    30
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Thank's all guy's
    krishna
     
    KRISHNA KUMAR, Apr 14, 2009 IP