프레임 / IFrame을 온로드 이벤트
정의 및 사용
온로드 이벤트는 프레임 이후 트리거 또는 iframe로드가 완료되었습니다.
문법
onload="JavaScriptCode"
参数 | 描述 |
---|---|
JavaScriptCode | 必须。在事件触发后执行的Javascript代码。 |
브라우저 지원
모든 주요 브라우저는 온로드 이벤트를 지원
예
예 1
프레임이로드 한 후 팝업 즉시 "프레임은로드"
<html>
<head>
<script>
function load()
{
alert("Frame is loaded");
}
</script>
</head>
<frameset cols="50%,50%">
<frame src="frame_a.htm" onload="load()">
<frame src="frame_b.htm">
</frameset>
</html>
<head>
<script>
function load()
{
alert("Frame is loaded");
}
</script>
</head>
<frameset cols="50%,50%">
<frame src="frame_a.htm" onload="load()">
<frame src="frame_b.htm">
</frameset>
</html>
»시도
예 2
iframe이 팝업을로드 한 후 즉시 "Iframe에로드된다"
<html>
<head>
<script>
function load()
{
alert("Iframe is loaded");
}
</script>
</head>
<iframe onload="load()" src="http://w3cschool.cc">
<p>Your browser does not support iframes.</p>
</iframe>
</html>
<head>
<script>
function load()
{
alert("Iframe is loaded");
}
</script>
</head>
<iframe onload="load()" src="http://w3cschool.cc">
<p>Your browser does not support iframes.</p>
</iframe>
</html>
»시도
프레임 / IFrame을 객체