특정 페이지에 도달 한 후 팝업 브라우저로 상위 브라우저로 돌아갑니다.
-
03-07-2019 - |
문제
링크 클릭에 열리는 팝업 (필연적으로 사용)이 있습니다. 사용자가 일련의 페이지를 선택하여 속성을 선택한 다음 장바구니로 전송합니다.
내 문제 : 사용자가 선택 과정의 끝에 도달 한 후에는 열린 팝업을 죽이고 요청을 원래 브라우저 (부모)로 다시 보내려면 사용자가 체크 아웃 할 수 있습니다.
내가 어떻게 할 것인지 아십니까?
해결책
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>
이것은 일이지만 내가 원하는대로는 아닙니다. 좋은 해결책을 찾으면 제안하십시오.
제휴하지 않습니다 StackOverflow