October 2009
M T W T F S S
    Nov »
 1234
567891011
12131415161718
19202122232425
262728293031  

Archives

Categories

  • [+]ASP.NET (7) 
  • [+]C# (87) 
  • [+]C++ (13) 
  • [+]Delphi (20) 
  • [—]JavaScript (24) 
  • [+]Regular Expressions (7) 
  • [+]SQL (13) 
  • [+]VB (100) 
  • [+]VB.NET (4) 

Online

Users: 5 Guests
  • Loading...


    Loading...

    Login






    Register | Lost password?

    Register





    A password will be mailed to you.
    Log in | Lost password?

    Retrieve password





    A confirmation mail will be sent to your e-mail address.
    Log in | Register
  • Allow entering the specified character set to a textbox control

    URL: http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=1907&lngWId=2

    /* —————————————————————- AllowOnly: This function allow entering just the specified Expression to a textbox or textarea control. Parameters: Expression = Allowed characters. a..z => ONLY LETTERS 0..9 => ONLY NUMBERS other symbols… Example: use the onKeyPress event to make this function work: //Allows only from A to Z onKeyPress="AllowOnly('a..z');" //Allows only from 0 to 9 onKeyPress="AllowOnly('0..9');" //Allows only A,B,C,1,2 and 3 onKeyPress="AllowOnly('abc123');" //Allows only A TO Z,@,#,$ and % onKeyPress="AllowOnly('a..z|@#$%');" //Allows only A,B,C,0 TO 9,.,,,+ and - onKeyPress="AllowOnly('ABC|0..9|.,+-');" Remarks: Use the pipe "|" symbol to separate a..z from 0..9 and symbols Returns: None —————————————————————- */ function AllowOnly(Expression) { Expression = Expression.toLowerCase(); Expression = Replace(Expression, 'a..z', 'abcdefghijklmnopqrstuvwxyz'); Expression = Replace(Expression, '0..9', '0123456789'); Expression = Replace(Expression, '|', ''); var ch = String.fromCharCode(window.event.keyCode); ch = ch.toLowerCase(); Expression = Expression.toLowerCase(); var a = Expression.indexOf(ch); if (a == -1) window.event.keyCode = 0; }

    Share: These icons link to social bookmarking sites where readers can share and discover new web pages.
    • Digg
    • del.icio.us
    • Bloglines
    • Facebook
    • Google Bookmarks
    • LinkedIn
    • Technorati
    • TwitThis
    • Webnews

    Leave a Reply

     

     

     

    You can use these HTML tags

    <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <font color="" face="" size=""> <span style="">

    Spam Protection by WP-SpamFree Plugin