Open In App

HTML DOM Table Summary Property

Last Updated : 07 Sep, 2022
Comments
Improve
Suggest changes
Like Article
Like
Report

The HTML DOM Table Summary Property is used to set or return the value of the summary attribute of a <table> element. The summary attribute is used to define the summary of the table. 

Note: This property is not supported by HTML5

Syntax:

  • It is used to return the Table Summary property.
tableObject.Summary;
  • It is used to set the Table Summary Property.
tableObject.Summary="text";

Property Values: It contains the single value i.e text which specify the summary of the table. 

Example: Below HTML code illustrates how to return the summary property. 

HTML
<!DOCTYPE html>
<html>

<head>
    <title>
        Table Summary Property in HTML 
    </title>
    
    <style>
        table,
        td {
            border: 1px solid green;
        }

        h1 {
            color: green;
        }

        h2 {
            font-family: Impact;
        }

        body {
            text-align: center;
        }
    </style>
</head>

<body>
    <h1>GeeksforGeeks</h1>
    <h2>HTML DOM Table summary Property</h2>

    <table id="GFG" align="center" cellspacing="5" 
        summary="courses@GeeksForGeeks">
        
        <thead>
            <tr>
                <th>Subject</th>
                <th>Courses</th>
            </tr>
        </thead>
        <tr>
            <td>Java</td>
            <td>Fork Java</td>
        </tr>
        <tr>
            <td>Python</td>
            <td>Fork Python</td>
        </tr>
        <tr>
            <td>Placements</td>
            <td>Sudo Placement</td>
        </tr>
    </table>
    <br>

    <button ondblclick="Table_Caption()">
        Return Summary of Table 
    </button>
    
    <p id="sudo"></p>


    
    <script>
        function Table_Caption() {
            var w = document.getElementById("GFG").summary;
            document.getElementById("sudo").innerHTML = w;
        }
    </script>
</body>

</html>

Output:

 

Supported Browsers:

  • Google Chrome
  • Opera
  • Internet Explorer
  • Firefox
  • Apple Safari

Next Article

Similar Reads

  翻译: