给出一些传递的URL参数: /login.jsp?requestinfo=username
几乎所有东西似乎都运行良好但是当我调用showRequestInfo函数时它不会执行。它没有接收传递给它的参数。为什么这可能失败?
JS:
function LoginView(model, options) {
this.LoginModel = model;
this.bindEvents();
this.GetURLParameter();
}
//check for parameters being passed
//if params. are present show requested screen
LoginView.prototype.GetURLParameter = function (sParam) {
var sPageURL = window.location.search.substring(1);
var sURLVariables = sPageURL.split('&');
for (var i = 0; i < sURLVariables.length; i++) {
var sParameterName = sURLVariables[i].split('=');
if (sParameterName[0] == sParam) {
return sParameterName[1];
}
}
this.showRequestInfo(UrlParameter);
};
LoginView.prototype.showRequestInfo = function (sParam) {
var UrlParameter = GetURLParameter('requestinfo');
if (UrlParameter == 'username') {
var getMyUsername = $('#getmyusername');
if (getMyUsername.hasClass('notvisible')) {
$('#logincontainer').animate({'left':'-280px'}, 'fast');
$('#logincontainer').removeClass('visible');
$('#logincontainer').addClass('notvisible');
getMyUsername.removeClass('notvisible');
getMyUsername.animate({'left':'35px'}, 'slow').addClass('visible');
}
}
else if (UrlParameter == 'password') {
var getMyPassword = $('#getmypassword');
if (getMyPassword.hasClass('notvisible')) {
$('#logincontainer').animate({'left':'-280px'}, 'fast');
$('#logincontainer').removeClass('visible');
$('#logincontainer').addClass('notvisible');
getMyPassword.removeClass('notvisible');
getMyPassword.animate({'left':'35px'}, 'slow').addClass('visible');
}
}
};
为什么我的showRequestInfo函数没有被执行?