의 main.htm
<html>
<head>
<script>
getText = function(s)
{
alert(s);
}
</script>
</head>
<body>
<iframe src="otherFrame.htm"></iframe>
</body>
</html>
otherFrame.htm
<html>
<head>
<script>
botherParent = function()
{
parent.getText(document.getElementById("textInput").value);
};
window.onload = function()
{
}
</script>
</head>
<body>
<input type="text" id="textInput" />
<span onclick="botherParent()">Stuff goes here</span>
</body>
</html>
기본적으로, 자식 인라인 프레임에서 사용 부모는 부모의 창 개체에 액세스 할 수 있습니다. 전역 변수는 전역 함수와 마찬가지로 창에 저장됩니다. 이 때문에 부모 변수에 전역 변수 "foo"를 정의하면 하위 프레임과 함께 parent.foo를 사용하여 액세스 할 수 있습니다.
희망 하시겠습니까?
감사합니다. 올바른 방향으로 나아가는 데 도움이되었습니다. – Andelas