Advertisement

08.19.2008 at 05:52PM PDT, ID: 23661683 | Points: 500
[x]
Attachment Details

Url validation in javascript

Asked by Saroj13 in JavaScript

Tags: ,

Hi ,

I have implemented the function for Url validation. It works fine, but if I put long URL like
ex: http://test.com/portal/site/menuitem.bc20064d3988cfc006d0c110cd2db1a0/?vgnextoid=9ce3533724772110VgnVCM1000008c321b0aRCRD&vgnextfmt=default?WT.mc_id=mra_081808
Then validation doesn't work.

Here is my Code:
function checkUrl()
    {
        var URL=  document.getElementById('txtURL_Insert');
        if(URL.value.match(/^((ht|f)tp(s?))\:\/\/\w+([\.\-]\w+)*\.\w{2,4}(\:\d+)*([a-zA-Z0-9\+\$#~_\=\:\,\\\/\.\-\?&\%\#\$]\w+)*\/?$/i) )    
            {
                return true;
            }
        else
            {
                alert("Please enter correct url.");
                URL.select();
                URL.focus();
                return false;
            }
 
}//checkUrl

Please let me know where is the problem.Start Free Trial
 
Loading Advertisement...
 
[+][-]08.19.2008 at 06:23PM PDT, ID: 22265357

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 14-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.19.2008 at 06:56PM PDT, ID: 22265546

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 14-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20081112-EE-VQP-43 / EE_QW_2_20070628