| Ex No: 7 | GET WINDOW SIZE |
|---|---|
| Aim: | To write a JavaScript code to get the window size of the open window. |
| Algorithm | |
| Step1: Create a folder “Ex7” to place the HTML files. | |
| Step2: Create HTML file “index.html”. | |
| Step3: Use document.getElementById to get the span tag to display width and height. | |
| Step4: Use window.innerHeight and window.innerWidth property to get the size of the window. | |
| Step5: Use "onresize" event on the body tag to display width and height of the window when it is resized. | |
| Source Code | Try It |
index.html
|
|
| Result: | Thus JavaScript code is written to get the window size of the open window. |