リンククリックで開くポップアップ(私が必要に応じて使用した)があります。私はユーザーがショッピングカートに送られる属性を選ぶ一連のページを通過するようにしています。ポップアップブラウザ特定のページに達した後に親ブラウザに戻る
私の問題:ユーザーが選択プロセスの最後に達した後、開いているポップアップを強制終了し、元のブラウザ(親)にリクエストを送信して、ユーザーがチェックアウトできるようにします。
どうすればいいですか?
リンククリックで開くポップアップ(私が必要に応じて使用した)があります。私はユーザーがショッピングカートに送られる属性を選ぶ一連のページを通過するようにしています。ポップアップブラウザ特定のページに達した後に親ブラウザに戻る
私の問題:ユーザーが選択プロセスの最後に達した後、開いているポップアップを強制終了し、元のブラウザ(親)にリクエストを送信して、ユーザーがチェックアウトできるようにします。
どうすればいいですか?
Javascript:子(ポップアップ)ウィンドウ。
window.opener.location = 'page.html";
window.close();
これはあなたの探しているものですか?
親ウィンドウには、JavaScriptの「オープナー」を使用してアクセスできます。 例:私の子フォームで
window.opener.title='hello parent window';
または
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>
これは仕事ではなく、として私は欲しい、誰かが見つかった場合g ood solutionをお勧めします。
あなたは素晴らしいです – MedicineMan