parent.html
<html>
<head>
<script type="text/javascript">
var frmFunc = undefined;
function callfrmFunc(){
if(typeof frmFunc != 'undefined'){
frmFunc();
}else{
alert('자식창 함수 호출 실패!')
}
}
</script>
</head>
<body>
<iframe id="testIframe" src="child.html"></iframe>
<button onclick="callfrmFunc();">Access function</button>
</body>
</html>
child.html
<html>
<head>
<script type="text/javascript">
function childFunc(){
alert('자식창 함수 호출 성공!')
}
parent.frmFunc = childFunc;
</script>
</head>
<body>
부모창에서 자식창 함수 호출 테스트!
</body>
</html>
댓글 없음:
댓글 쓰기