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

HTML DOM Table createCaption() মেথড: টেবিল ক্যাপশন তৈরি করা

HTML DOM table createCaption() মেথড একটি খালি <caption> এলিমেন্ট তৈরি করে এবং এটিকে HTML ডকুমেন্টের টেবিলে যোগ করে।

সিনট্যাক্স

সিনট্যাক্স নিচে দেওয়া হলো:

object.createCaption()

উদাহরণ

HTML DOM table createCaption() মেথডের একটি উদাহরণ:

<!DOCTYPE html> <html> <style>    body {       color: #000;       background: lightblue;       height: 100vh;       text-align: center;    }    table {       margin: 2rem auto;    }    caption {       color: #db133a;    }    .btn {       background: #db133a;       border: none;       height: 2rem;       border-radius: 2px;       width: 40%;       display: block;       color: #fff;       outline: none;       cursor: pointer;       margin: 1rem auto;    }    .show {       font-size: 1.2rem;    } </style> <body> <h1>DOM Table createCaption() Method Demo</h1> <table border="2"> <tr> <td>Name</td> <td>Roll No.</td> </tr> <tr> <td>John</td> <td>071717</td> </tr> <tr> <td>Jane</td> <td>031717</td> </tr> </table> <button onclick="create()" class="btn">Create Caption</button> <script>    function create() {       var tableCaption = document.querySelector('table').createCaption();       tableCaption.innerHTML = "Student Data";    } </script> </body> </html>

আউটপুট

HTML DOM Table createCaption() মেথড: টেবিল ক্যাপশন তৈরি করা

"Create Caption" বাটনে ক্লিক করুন টেবিলের জন্য একটি ক্যাপশন তৈরি করতে।

HTML DOM Table createCaption() মেথড: টেবিল ক্যাপশন তৈরি করা

  1. HTML DOM Table deleteCaption() মেথড: টেবিল ক্যাপশন মুছে ফেলা

  2. HTML DOM Table insertRow() মেথড: টেবিলে নতুন সারি যোগ করা

  3. HTML DOM Table createTHead() মেথড: টেবিল হেডার তৈরি করা

  4. HTML DOM Table createTFoot() মেথড: টেবিল ফুটার তৈরি করা