Thursday, December 6, 2012

JAVA SCRIPT to get url parameters

function getUrlParameteres() {
   var vars = {};
   var parts = window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m,key,value) {
        vars[key] = value;
   });
return vars;
}
function autoLogin(){
    var username = getUrlParameteres()["username"];
   var password = getUrlParameteres()["password"];
   if(username!=null && password !=null && username!=’undefined’ &&       password!=’undefinied’){
             document.systemLoginForm.userName.value=username;
             document.systemLoginForm.password.value=password; 
             document.systemLoginForm.submit();
    }
}

No comments:

Post a Comment