English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

HTML Referenzhandbuch

Vollständiges Verzeichnis der HTML-Tags

HTML onresize-Event-Eigenschaft

Der resize-Event wird ausgelöst, wenn die Dokumentansicht angepasst wird.

HTML Event Attributes

Online-Beispiel

Führen Sie JavaScript aus, wenn der Browserfenstergröße geändert wird:

<!DOCTYPE html>
<html>
<head>
<title>Verwendung der onresize-Event-Eigenschaft von HTML (Grund教程网 oldtoolbag.com)</title>
</head>
<body onresize="myFunction()">
<p>Try to resize the browser window.</p>
<script>
function myFunction() {
  alert("You have changed the size of the browser window!");
}
</script>
</body>
</html>
Test See ‹/›

Browser Compatibility

IEFirefoxOperaChromeSafari

All major browsers support the onresize event attribute

Definition and Usage

The onresize attribute is triggered when the browser window size is adjusted.

The onresize attribute is commonly used to adjust the window size.

HTML 4.01 With HTML5The Differences

None.

Syntax

<element onresize="script">

Attribute Value

ValueDescription
scriptSpecifies the script to be executed when the onresize event is triggered.
HTML Event Attributes