Popup 到达特定页面后,弹出浏览器返回到父浏览器
我有一个弹出窗口(我需要使用),点击链接打开。我让用户通过一系列页面选择属性,然后发送到购物车 我的问题是:在用户完成选择过程后,我想关闭打开的弹出窗口,并将请求发送回原始浏览器(父浏览器),以便用户可以签出 你知道我该怎么做吗?Javascript:在子窗口(弹出窗口)中Popup 到达特定页面后,弹出浏览器返回到父浏览器,popup,Popup,我有一个弹出窗口(我需要使用),点击链接打开。我让用户通过一系列页面选择属性,然后发送到购物车 我的问题是:在用户完成选择过程后,我想关闭打开的弹出窗口,并将请求发送回原始浏览器(父浏览器),以便用户可以签出 你知道我该怎么做吗?Javascript:在子窗口(弹出窗口)中 这就是您想要的吗?可以使用JavaScript中的“opener”访问父窗口。 例如: 或 “我的孩子”形式的脚本: <script language="JavaScript" type="text/javascrip
这就是您想要的吗?可以使用JavaScript中的“opener”访问父窗口。 例如: 或
“我的孩子”形式的脚本:
<script language="JavaScript" type="text/javascript">
function SetData() {
// form validation
// var frmvalidator = new Validator("myForm");
// frmvalidator.addValidation("name","req","Please enter Account Name");
// get the new dialog values
var str1 = document.getElementById("name").value;
var winArgs = str1;
// pass the values back as arguments
window.returnValue = winArgs;
window.close();
document.myForm.submit();
}
</script>
函数SetData(){
//表单验证
//var frmvalidator=新验证器(“myForm”);
//frmvalidator.addValidation(“名称”、“请求”、“请输入帐户名称”);
//获取新的对话框值
var str1=document.getElementById(“名称”).value;
var-winArgs=str1;
//将值作为参数传回
window.returnValue=winArgs;
window.close();
document.myForm.submit();
}
我的父窗体中的脚本:
<% @account_head= current_company.account_heads.find_by_name("Sundry Debtors")%>
<script type="text/javascript">
function OpenDialog() {
var winSettings = 'center:yes;resizable:no;help:yes;status:no;dialogWidth:450px;dialogHeight:200px';
// return the dialog control values after passing them as a parameter
winArgs = window.showModalDialog('<%= "/accounts/new?account_head_id=#{@account_head.id} #man" %>', winSettings);
if(winArgs == null) {
window.alert("no data returned!");
} else {
// set the values from what's returned
document.getElementById("to_account_auto_complete").value = winArgs;
}
}
</script>
函数OpenDialog(){
var winSettings='中心:是;可调整大小:否;帮助:是;状态:否;对话框宽度:450px;对话框高度:200px';
//将对话框控件值作为参数传递后返回
winArgs=window.showModalDialog(“”,winSettings);
if(winArgs==null){
window.alert(“没有返回数据!”);
}否则{
//根据返回的内容设置值
document.getElementById(“to\u account\u auto\u complete”).value=winArgs;
}
}
这是工作,但不是我想要的,任何一个如果找到好的解决方案,请建议
window.opener.location.href='http://redirect.address';
<script language="JavaScript" type="text/javascript">
function SetData() {
// form validation
// var frmvalidator = new Validator("myForm");
// frmvalidator.addValidation("name","req","Please enter Account Name");
// get the new dialog values
var str1 = document.getElementById("name").value;
var winArgs = str1;
// pass the values back as arguments
window.returnValue = winArgs;
window.close();
document.myForm.submit();
}
</script>
<% @account_head= current_company.account_heads.find_by_name("Sundry Debtors")%>
<script type="text/javascript">
function OpenDialog() {
var winSettings = 'center:yes;resizable:no;help:yes;status:no;dialogWidth:450px;dialogHeight:200px';
// return the dialog control values after passing them as a parameter
winArgs = window.showModalDialog('<%= "/accounts/new?account_head_id=#{@account_head.id} #man" %>', winSettings);
if(winArgs == null) {
window.alert("no data returned!");
} else {
// set the values from what's returned
document.getElementById("to_account_auto_complete").value = winArgs;
}
}
</script>