HTML에는 두 가지 기능이 있습니다. 하나는 경고 만있는 abc이고 다른 하나는 미리 정의 된 HTML 문자열로 채우기 window.open()을 사용하여 새 창을 만드는 것입니다. 부모 HTML에서 함수를 호출하고 싶습니다. parent.abc 및 window.parent.abc를 호출 해 보았습니다. 둘 다 작동하지 않습니다.부모로부터의 호출 함수
<html>
<body>
<button onclick="myfunction()" type="button">A new Window</button>
<script>
var myWindow;
function abc() {
alert("abc");
};
function myfunction() {
var htmlholder = '<!DOCTYPE html>'+
'<html>'+
'<body>'+
'<p>Here is another HTML<\/p>'+
'<button type="button1" onclick="parent.abc()">Call parentabc<\/button>'+
'<\/body>'+
'<\/html>';
myWindow = window.open("", "MsgWindow", "width=200,height=100");
myWindow.document.write(htmlholder);
};
</script>
</body>
</html>
팝업/탭이'opener', 프레임은'parent' 있습니다. – Teemu
설명해 주셔서 감사합니다. – user3707157