Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

onresize event

onresize event

Event Object Reference Event Object

Example

Execute JavaScript code when the browser is resized:

Try it »


Definition and Usage

The onresize event occurs when the window or frame is resized.

Syntax

In HTML:

<

element

onresize="

SomeJavaScriptCode

">

In JavaScript:

window.onresize=function(){

SomeJavaScriptCode

};

Parameters Description
SomeJavaScriptCode Required. Specifies the JavaScript to be executed when the event occurs.

Browser support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the onresize event.


The following HTML tags support the onresize event:

,

, , ,
, ,