কম্পিউটার টিউটোরিয়াল

জাভাস্ক্রিপ্টে Window innerWidth এবং innerHeight প্রপার্টি


innerWidth প্রপার্টি উইন্ডো কন্টেন্ট এরিয়ার প্রস্থ রিটার্ন করে এবং innerHeight প্রপার্টি উইন্ডো কন্টেন্ট এরিয়ার উচ্চতা রিটার্ন করে।

উদাহরণ

<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title>Document</title> <style>    body {       font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;    }    .result{       font-size: 20px;       font-weight: 500;    } </style> </head> <body> <h1>Window innerWidth and innerHeight Properties</h1> <div style="color: green;" class="result"></div> <button class="Btn">CLICK HERE</button> <h3> Click on the above button get the innerWidth and innerHeight of the window. </h3> <script>    let resEle = document.querySelector(".result");    document.querySelector(".Btn").addEventListener("click", () => {       resEle.innerHTML = "Window.innerWidth = "+window.innerWidth + '<br>';       resEle.innerHTML += "Window.innerHeight = "+window.innerHeight + '<br>';    }); </script> </body> </html>

আউটপুট

উপরোক্ত কোড নিম্নলিখিত আউটপুট তৈরি করবে −

জাভাস্ক্রিপ্টে Window innerWidth এবং innerHeight প্রপার্টি

'CLICK HERE' বাটনে ক্লিক করলে −

জাভাস্ক্রিপ্টে Window innerWidth এবং innerHeight প্রপার্টি

  1. জাভাস্ক্রিপ্টে অবজেক্ট প্রপার্টি অ্যাক্সেস করার পদ্ধতি

  2. জাভাস্ক্রিপ্টে স্ট্যাটিক প্রোপার্টি

  3. জাভাস্ক্রিপ্টে শেয়ার্ড প্রোপার্টি

  4. জাভাস্ক্রিপ্টে বিদ্যমান অবজেক্টে প্রোপার্টি ও মেথড যোগ করা