html tutorial - onresize Attribute in HTML - html5 - html code - html form




Onresize attribute in html

Learn html - html tutorial - Onresize attribute in html - html examples - html programs

  • The onresize attribute triggers when the browser window is resized.
  • The onresize attribute is part of the Event attributes.

Syntax for onresize attribute in HTML:

<element onresize=”script”>

Applies To:

Element Attribute
<body> onresize

Attribute Values:

Value Description
script The script can run on onresize

Sample Coding for onresize Attribute in HTML:

Tryit<!DOCTYPE html>
<html>
  <head>
  <title>Wikitechy onresize  attribute</title>
  </head>
   <body onresize="onResize()">
       <p>Try to resize the browser window</p >
       <script>
       function onResize()  
       {
         alert ("You have changed the size of the Wikitechy window!");
       }
       </script>
   </body>
</html>

Code Explanation for onresize Attribute in HTML:

onresize Attribute Code Explanation

  1. The onresize attribute is used to call onresize() JavaScript function when browser window is resized.
  2. The JavaScript function onresize is used to display an alert message.

Output for onresize Attribute in HTML:

onresize Attribute Tag Output

  1. If we resize the window, the alert box will appear along with the text shown in the output.

Browser Support for onresize Attribute in HTML:

Yes Yes Yes Yes Yes

Related Searches to onresize attribute in html

Adblocker detected! Please consider reading this notice.

We've detected that you are using AdBlock Plus or some other adblocking software which is preventing the page from fully loading.

We don't have any banner, Flash, animation, obnoxious sound, or popup ad. We do not implement these annoying types of ads!

We need money to operate the site, and almost all of it comes from our online advertising.

Please add wikitechy.com to your ad blocking whitelist or disable your adblocking software.

×