English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
The resize event is triggered when the document view is adjusted in size.
Execute JavaScript when adjusting the browser window size:
<!DOCTYPE html> <html> <head> <title>HTML onresize Event Attribute Usage (Basic Tutorial Website 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 and see ‹/›
IEFirefoxOperaChromeSafari
All major browsers support the onresize event attribute
The onresize attribute is triggered when the browser window size is adjusted.
The onresize attribute is commonly used to adjust the window size.
None.
<element onresize="script">
Value | Description |
---|---|
script | Specifies the script to be executed when the onresize event is triggered. |