Computer >> कंप्यूटर ट्यूटोरियल >  >> प्रोग्रामिंग >> JavaScript

JavaScript DOM से टेबल कैप्शन कैसे बनाएं?


टेबल कैप्शन बनाने के लिए, DOM createCaption() मेथड का उपयोग करें।

उदाहरण

टेबल कैप्शन बनाने का तरीका जानने के लिए निम्न कोड चलाएं:

<!DOCTYPE html> <html>    <head>       <script>          function captionFunc(x) {             document.getElementById(x).createCaption().innerHTML = "Demo Caption";          }       </script>    </head>    <body>       <table style="border:2px solid black" id="newtable">          <tr>             <td>One</td>             <td>Two</td>          </tr>          <tr>             <td>Three</td>             <td>Four</td>          </tr>          <tr>             <td>Five</td>             <td>Six</td>          </tr>       </table>       <p>          <input type="button" onclick="captionFunc('newtable')" value="Display Table Caption">       </p>    </body> </html>

  1. CSS से तुलना टेबल (कॉम्पेरिजन टेबल) कैसे बनाएं? CSS से तुलना टेबल (कॉम्पेरिजन टेबल) कैसे बनाएं?

    कॉम्पेरिजन टेबल में फीचर कॉलम बाएं, प्लान कॉलम दाएं होते हैं। nth-child(even) से वैकल्पिक पंक्ति रंग, पहले कॉलम लेफ्ट-अलाइन, बाकी सेंटर। रिस्पॉन्सिव नहीं है लेकिन साफ डिज़ाइन। उदाहरण <!DOCTYPE html> <html> <head> <meta name=viewport content=width=device-width, initial-scale=

  1. CSS से रिस्पॉन्सिव टेबल कैसे बनाएं? CSS से रिस्पॉन्सिव टेबल कैसे बनाएं?

    रिस्पॉन्सिव टेबल के लिए टेबल को overflow-x: auto वाले डिव में लपेटें। छोटे स्क्रीन पर क्षैतिज स्क्रॉलबार दिखाई देगा, टेबल संरचना बनी रहती है। ज़ेबरा स्ट्रिपिंग शामिल है। उदाहरण <!DOCTYPE html> <html> <head> <meta name=viewport content=width=device-width, initial-scale=1>

  1. HTML में कैप्शन वाली टेबल कैसे बनाएं? HTML में कैप्शन वाली टेबल कैसे बनाएं?

    <caption> टैग का उपयोग HTML टेबल में कैप्शन (शीर्षक) जोड़ने के लिए <caption> टैग उपयोग करें। यह <table> टैग के तुरंत बाद आता है। उदाहरण <!DOCTYPE html> <html> <head> <style> table, td, th { border: 1px solid black; } </style> </head>