Results 1 to 6 of 6

Thread: Supress the "." character

  1. #1

    Thread Starter
    Fanatic Member venerable bede's Avatar
    Join Date
    Sep 2002
    Location
    The mystic land of Geordies
    Posts
    1,018

    Supress the "." character

    I have followed your advice on supressing characters but I cant seem to supress the "." character.

    Can anyone point me in the right direction as to how I can stop a user from entering the "." character in a textbox ?

    Parksie

  2. #2
    Frenzied Member Acidic's Avatar
    Join Date
    Sep 2003
    Location
    UK
    Posts
    1,090
    This seems to be working:
    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <title>Untitled Document</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <script type="text/javascript">
    function get_rid_of_dots(obj) {
    mystring = obj.value
    regexp = /\./
    mystring = mystring.replace(regexp,"")
    obj.value = mystring
    }
    </script>
    </head>
    
    <body>
    <input name="myTxt" type="text" id="myTxt" onKeyUp="get_rid_of_dots(this)">
    </body>
    </html>
    Have I helped you? Please Rate my posts.

  3. #3

    Thread Starter
    Fanatic Member venerable bede's Avatar
    Join Date
    Sep 2002
    Location
    The mystic land of Geordies
    Posts
    1,018
    THANK YOU

    Will U marry me.

    I have a lovely trailer !

    Parksie

  4. #4

    Thread Starter
    Fanatic Member venerable bede's Avatar
    Join Date
    Sep 2002
    Location
    The mystic land of Geordies
    Posts
    1,018
    Actually this regexp thin confuses the hell out of me.

    whats with the" /\./" ?

    Why the confusing "/\/" ?
    What would regexp look like if I wanted to remove "." and "£" ?

    Just curious. I think I had better do some client side study.

    Parksie

  5. #5
    Frenzied Member Acidic's Avatar
    Join Date
    Sep 2003
    Location
    UK
    Posts
    1,090
    Ok, I had written a really large response to this, until I found out, I'm not really sure, I'll find some pages that clarify it for you (and me)
    http://www.devshed.com/c/a/JavaScrip...RegExp-Object/

    http://wsabstract.com/javatutors/redev.shtml
    Have I helped you? Please Rate my posts.

  6. #6

    Thread Starter
    Fanatic Member venerable bede's Avatar
    Join Date
    Sep 2002
    Location
    The mystic land of Geordies
    Posts
    1,018
    Thanks ACIDIC. I'll give the url's a good seeing to.

    Parksie

Posting Permissions

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



Click Here to Expand Forum to Full Width