새소식

Front

[jQuery] 팝업창에서 부모창 호출, Opener

  • -
728x90

출처 : http://blog.naver.com/1004youandme/90190830348


//부모창의 필드값 갖고 오기

 

1. 일반적인 방법

var parentValue = opener.document.getElementById("parentId").value;

 

2. jQuery를 이용한 방법

$("#parentId", opener.document).val();

 

3. find를 이용한 방법

$(

 

 

//동적으로 생성한 폼을 부모창에 붙이기

 

1. jQuery를 이용한 방법

$(

 

 

//팝업창에서 부모창 함수 호출

1-1. 일반적인 방법

opener.location.href = "javascript:부모스크립트 함수명();";

 

1-2. 일반적인 방법

window.opener.fnCall();

 

2. jQuery를 이용한 방법

$(opener.location).attr("href", "javascript:부모스크립트 함수명();");

 

 

//팝업창에서 부모창으로 값 넘기기

1-1. 일반적인 방법

window.opener.document.getElementById("parentId").value = "부모창으로 전달할 값";

 

1-2. 일반적인 방법

window.opener.폼네임.parentInputName.value = value;

 

2. jQuery를 이용한 방법

$("#parentId", opener.document).val(부모창으로 전달할 값);

 

3. find를 이용한 방법

$(opener.document).find("#parentId").val(부모창으로 전달할 값);

 

 

//부모창의 CSS 변경

 

1. jQuery를 이용한 방법

$("#parentId", 

 

 

//팝업창 닫기

window.self.close();

 

 

//팝업창 자신 페이지 새로고침

document.location.reload();

 

 

//팝업창에서 부모창 새로고침(새로고침 의사 표현을 묻는 창이 뜸)

window.opener.parent.location.reload();

window.opener.document.location.reload();


반응형
Contents

포스팅 주소를 복사했습니다

이 글이 도움이 되었다면 공감 부탁드립니다.