onresizeEvent

事件对象参考手册Event Object

Example

Execute JavaScript code when the browser is resized:

<body onresize="myFunction()">

Try it Yourself »

Definition and Usage

The onresize event occurs when a 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 execute when the event occurs.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the onresize event


The following HTML tags support the onresize event:

<a>, <address>, <b>, <big>, <blockquote>, <body>, <button>, <cite>, <code>, <dd>, <dfn>, <div>, <dl>, <dt>, <em>, <fieldset>, <form>, <frame>, <h1> to <h6>, <hr>, <i>, <img>, <input>, <kbd>, <label>, <legend>, <li>, <object>, <ol>, <p>, <pre>, <samp>, <select>, <small>, <span>, <strong>, <sub>, <sup>, <table>, <textarea>, <tt>, <ul>, <var>


事件对象参考手册Event Object Other Extensions