Javascript DOM HTML Body handle resize event
<!DOCTYPE html> <html> <body onresize="myFunction()"> <p>Window resized <span id="demo">0</span> times.</p> <script> var x = 0;//from w w w . j a va 2 s. c o m function myFunction() { var txt = x += 1; document.getElementById("demo").innerHTML = txt; } </script> </body> </html>