나는 및 태그를 기반으로하는 accient 프로젝트에서 작업 중입니다. 나는 아이 프레임에 자바 스크립트 함수를 지정하는 방법은 다음과자식에 지정된 javascript 함수를 호출하는 방법 <frame>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
</head>
<frameset rows="75px,*" frameborder="0">
<frame name="frame1" src="frames/frame1.html">
<frameset class="child_frameset">
<frame name="frame3" src="frames/frame3.html">
</frameset>
</frameset>
</html>
(frame3.html) :
<!DOCTYPE html>
<html lang="en">
<head>
<script type="text/javascript">
function helloWorld(){
alert('hello world!');
}
</script>
</head>
<body>
<h1>I'm frame 3</h1>
</body>
</html>
다음은 상위 페이지 (index.html을)의 일반적인 HTML 구조입니다 내 임무는 helloWorld() 기능을 호출하는 것입니다. 어떻게해야합니까?
미리 감사드립니다. contentWindow, contentDocument에 대한
document.getElementById('frame3').contentWindow.helloWorld();
부모로부터 기능을 호출하려고합니까? – Ibu
예! 부모 페이지 (index.html)에서 ** helloWorld (**) 함수를 호출하려고합니다. – LoomyBear