Javascript validation for URL

Discussion in 'JavaScript' started by technoguy, Feb 12, 2007.

Thread Status:
Not open for further replies.
  1. #1
    I want to validate textbox using java script for URL.

    Any help will be appreciated. Thank you
     
    technoguy, Feb 12, 2007 IP
  2. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #2
    
    function is_valid_url(url)
    {
         return url.match(/^(ht|f)tps?:\/\/[a-z0-9-\.]+\.[a-z]{2,4}\/?([^\s<>\#%"\,\{\}\\|\\\^\[\]`]+)?$/);
    }
    
    
    
    Code (javascript):
    This should do it.
     
    nico_swd, Feb 12, 2007 IP
Thread Status:
Not open for further replies.