1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

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.