2012-12-29 3 views
2

이것은 내 마지막 질문과 비슷하지만 문제는 다릅니다. 내 모든 자바 스크립트 함수에 대한 별도의 자바 스크립트 파일을 사용합니다. 이 파일은 내 메인 윈도우에서 호출되며, 내 자식 윈도우에 의해 별도의 인스턴스에서 호출됩니다. 내 코드는 IE 9와 10을 제외한 모든 브라우저에서 작동합니다. 이전 버전의 IE는 테스트하지 않았습니다.정의되지 않거나 null 참조의 속성을 가져올 수 없습니다.

IE가 불쾌한 전화 번호는 window.opener.savetoparent($targetval);입니다. 이전 코드는 opener.savetoparent($targetval);이고 그 전에 간단히 아이의 부모에게 직접 변경했습니다. 나는 IE로 갔고 행동에 변화가없는 다른 기사에서 제안 된 보호 모드를 가능하게했다. Savetoparent()은 자식과 부모 모두에게 사용할 수 있으므로 부모에서 실행하려면 따개로 호출해야합니다.

내가 점점 오전 오류는 다음과 같습니다 Unable to get property 'savetoparent' of undefined or null reference. 코드입니다 : 부모 함수에

function saveandclose($wintype, $propid) { 

switch($wintype) { 
    case 'ccdetail': 
     var $targetval = $('#cc-total').val(); 
     var $fieldname = 'closingcoststotal'; 
     break; 
} 

window.opener.savetoparent($targetval); 
closewindow(); 
} 

안전한이다 : 당신이에 흘릴 수

function savetoparent($targetval) { 
    $('#' + $parentloc).val($targetval); 
    var $name = $('#' + $parentloc).attr("name"); 
    var $rawtargetval = jsstrtonum($targetval); 
    processrvsave($propertyid, $name, $rawtargetval); 
    calcrvtotals(); 
} 

모든 빛은 크게 감상 할 수있다.

창이하여 showModalDialog에는 오프너가 없다이

if(window.showModalDialog) { 
    window.showModalDialog($childname + '.php?ploc=' + $parentloc + '&propid=' + $propid, '', 'dialogWidth: ' + $winwidth + 'px; dialogHeight: ' + $winheight + 'px;') 
} 
else { 
    window.open($childname + '.php?ploc=' + $parentloc + '&propid=' + $propid, '', 'width=' + $winwidth + ', height=' + $winheight + ', modal=yes'); 
} 
+0

당신을했다 사용하는 방법입니다 .. 몇 년에 window.open에 모달 매개 변수가되지 않았습니다 상위 페이지의 스크립트를 사용하여 하위 창을여시겠습니까? – mplungjan

+0

예. 그것은 시작하는 모달 창 – bnorton

+0

코드로 개방하는 것은 \t 입니다 (window.showModalDialog) { \t \t window.showModalDialog ($의 childname + '.PHP? ploc ='+ $의 parentloc + '및 PROPID ='+ $ 경우 ($ childname + '.php? ploc ='propid, '', 'dialogWidth :'+ $ winwidth + 'px; dialogHeight :'+ $ winheight + 'px;') \t else { \t \t window.open + parentloc + '& propid ='+ $ propid, '', 'width ='+ $ winwidth + ', height ='+ $ winheight + ', 모달 = 예'); \t} – bnorton

답변

2

처럼 시작됩니다. 에 ReturnValue를 사용

또한 여기에

는 ReturnValue를 다음

if(window.showModalDialog) { 
    $targetval = window.showModalDialog($childname + '.php?ploc=' + $parentloc + '&propid=' + $propid, 
    window, 
    'dialogWidth: ' + $winwidth + 'px; dialogHeight: ' + $winheight + 'px;')) 
    if(targetval) savetoparent($targetval); 
} 
else { 
    window.open($childname + '.php?ploc=' + $parentloc + '&propid=' + $propid, '', 'width=' + $winwidth + ', height=' + $winheight + ', modal=yes'); 
} 

function saveandclose($wintype, $propid) { 
    var $targetval =""; 
    switch($wintype) { 
    case 'ccdetail': 
     $targetval = $('#cc-total').val(); 
     // var $fieldname = 'closingcoststotal'; I do not see this used anywhere 
     break; 
    } 

    if (window.opener) window.opener.savetoparent($targetval); 
    else returnValue = $targetval; 
    closewindow(); 
} 
+0

고맙습니다. 이 작동합니다. – bnorton

관련 문제