Frame/IFrame onloadEreignis
Frame/IFrame-Objekt
Definition und Verwendung
Das onload-Ereignis wird ausgelöst, wenn ein Frame oder iframe das Laden abgeschlossen hat.
Syntax
onload="JavaScriptCode"
| Parameter | Beschreibung |
|---|---|
| JavaScriptCode | Erforderlich. Der JavaScript-Code, der ausgeführt wird, nachdem das Ereignis ausgelöst wurde. |
Browser-Unterstützung
![]()
![]()
![]()
![]()
![]()
Alle gängigen Browser unterstützen das onload-Ereignis
Beispiele
Beispiel 1
Blenden Sie "Frame is loaded" sofort ein, nachdem der Frame fertig geladen wurde:
<html>
<head>
<script>
function load()
{
alert("Frame is loaded");
}
</script>
</head>
<frameset cols="50%,50%">
<frame src="frame_a.htm.html" onload="load()">
<frame src="frame_b.htm.html">
</frameset>
</html>
<head>
<script>
function load()
{
alert("Frame is loaded");
}
</script>
</head>
<frameset cols="50%,50%">
<frame src="frame_a.htm.html" onload="load()">
<frame src="frame_b.htm.html">
</frameset>
</html>
Selbst ausprobieren »
Beispiel 2
Pop-up "Iframe ist geladen" sofort anzeigen, nachdem das Iframe fertig geladen wurde:
<html>
<head>
<script>
function load()
{
alert("Iframe is loaded");
}
</script>
</head>
<iframe onload="load()" src="http://w3cschool.cc">
<p>Ihr Browser unterstützt keine Iframes.</p>
</iframe>
</html>
<head>
<script>
function load()
{
alert("Iframe is loaded");
}
</script>
</head>
<iframe onload="load()" src="http://w3cschool.cc">
<p>Ihr Browser unterstützt keine Iframes.</p>
</iframe>
</html>
Selbst ausprobieren »
Frame/IFrame-Objekt Andere Erweiterungen