リンクをクリックすると開くポップアップ(必然的に使用しました)があります。ユーザーに一連のページを調べて属性を選択し、ショッピングカートに送信してもらいます。
私の問題:ユーザーが選択プロセスの最後に達した後、開いているポップアップを強制終了し、ユーザーがチェックアウトできるようにリクエストを元のブラウザー(親)に送り返したいと思います。
私がこれをどのように行うかについて何か考えはありますか?
リンクをクリックすると開くポップアップ(必然的に使用しました)があります。ユーザーに一連のページを調べて属性を選択し、ショッピングカートに送信してもらいます。
私の問題:ユーザーが選択プロセスの最後に達した後、開いているポップアップを強制終了し、ユーザーがチェックアウトできるようにリクエストを元のブラウザー(親)に送り返したいと思います。
私がこれをどのように行うかについて何か考えはありますか?
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>
これは動作しますが、私が望むようにはなりません。良い解決策が見つかった場合は、誰でも提案してください。