我的网页上有一个链接:
<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它正在工作。但是当在弹出窗口中使用它时,它不起作用。任何人都知道我如何点击弹出窗体上的按钮并重定向到登录页面?
答案 0 :(得分:0)
尝试:
function ChangePassword()
{
window.location.href = 'login.php';
return false;
}