重定向到一个页面点击一个弹出按钮后
问题描述:
我在我的网页中的链接:重定向到一个页面点击一个弹出按钮后
<a class="dropdown-item" href="#" onclick="ChangePasswordPopup();">Change your password</a>
点击该链接后,弹出打开定义如下:
function ChangePasswordPopup()
{
var html=""; // to store the html content
// Build the content of the change password popup form
html+="<div class='col-md-12 divChangePasswordPopup' id='divChangePasswordPopup'>";
html+="<div class='divBackground' id='divBackground' onclick='ClosePopup();'></div>";
html+="<div class='panel panel-primary divForeground' id='divForeground'>";
html+="<div class='panel-heading'>";
html+="Change your password";
html+="<a href='#' onclick='ClosePopup();' id='CloseButtonLink' title='close'>";
html+="<span class='glyphicon glyphicon-remove' style='float: right; font-size: 18px; padding: 3px 3px 0px 0px;'></span>";
html+="</a>";
html+="</div>";
html+="<div class='panel-body'>";
html+="<form name='frmChangePassword' onsubmit='ChangePassword(this);'>"; .....form textboxes goes here.....
html+="<button type='submit' name='btnSave' class='btn btn-primary-outline'";
html+="style='position: relative; float:right;'>Save Changes <i class='glyphicon glyphicon-chevron-right'></i></button>";
html+="<br/></div></li></form></div></div></div>";
$("#divChangePasswordPopup").html(html);
disablescroll(); // disable the scrollbar for the webpage
return(false); // to prevent the calling form from executing
}
这是加工。当我尝试点击保存按钮时,我只是想重定向到另一页,所以我这样做:
function ChangePassword(frm)
{
window.location="login.php";
return(false); // to prevent the calling form from executing
}
但它不工作。如果我在它正常工作的网页上的普通按钮中使用相同的window.location。但是在弹出窗口中使用它时,它不起作用。任何人都知道如何点击弹出窗体上的按钮并重定向到登录页面?
答
尝试:
function ChangePassword()
{
window.location.href = 'login.php';
return false;
}
'window.location.href = “login.php中”;' – DININDU
window.location.href不工作要么。虽然它的工作,如果按钮是在网页上 –
更改