Cadre / IFrame événement onload
Définition et utilisation
événement onload est déclenché après un cadre ou iframe a terminé le chargement.
grammaire
onload="JavaScriptCode"
参数 | 描述 |
---|---|
JavaScriptCode | 必须。在事件触发后执行的Javascript代码。 |
support du navigateur
Tous les principaux navigateurs prennent en charge l'événement onload
Exemples
exemple 1
Après le châssis a chargé pop-up immédiatement "Frame est chargé":
<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>
Essayez »
exemple 2
Après l'iframe a chargé pop up immédiatement "Iframe est chargé":
<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>
Essayez »
Structure / objets iFrame