单击弹出窗口中的按钮后重定向到页面
Redirecting to a page after clicking button in a popup
>我的网页上有一个链接:
<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
}
但它不起作用。如果我在网页上的普通按钮中使用相同的窗口位置,它就可以工作。但是在弹出窗口中使用它时,它不起作用。有人知道我如何单击弹出表单上的按钮并重定向到登录页面吗?
JSFIDDLE 代码中的问题
尝试:
function ChangePassword()
{
window.location.href = 'login.php';
return false;
}
相关文章:
- JavaScript下拉菜单-点击按钮并根据所选值重定向到url
- 我想重定向点击,然后更改按钮文本,我该怎么做
- 单击转盘按钮后重定向到另一个页面
- 如何在重定向到asp.net中单击按钮的下一页之前应用javascript警报
- 如何将图像制作为按钮并将其重定向到另一个页面
- 重定向到“提交”按钮上的其他控制器
- 在Jquery easyui中,多个选项卡提交按钮点击事件正在重定向到主页(第一个)选项卡
- 按钮don't使用onClick-Javascript HTML重定向
- 单击弹出窗口中的按钮后重定向到页面
- Javascript按钮,它提交联系人表单7表单,然后重定向到URL
- 选择其中一个单选按钮,然后单击“提交”,重定向其他页面
- 如何在提交按钮上触发模态&重定向Rails
- 我需要一个注册按钮,它可以将数据发送到mySQL服务器,也可以在单击时重定向
- Node/Javascript:验证后重定向按钮
- 重定向至javascript中单击按钮的新页面
- 防止在 html 中重定向按钮到页面
- 退出弹出重定向,但仅在退出时执行,而不是在单击页面上的任何其他 html 重定向按钮时执行
- 在警报对话框中单击“重定向”按钮
- 如果代码正确,单击重定向按钮
- 如何使用php重定向按钮点击