td/th abbrProperty

td/th 对象参考手册td/th Object

Definition and Usage

The abbr property sets or returns the abbreviated version of the content in a table cell (for non-visual media such as speech and Braille).

If this property is set, the user only hears the value of the abbr property (not the content in the cell).

Syntax

Set the abbr property:

tdObject.abbr="text"

or

thObject.abbr="text"

Return the abbr property:

tdObject.abbr

or

thObject.abbr

Tip:The abbr property has no default value.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the abbr property.


Example

Example

The following example alerts the abbr of the first cell:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Example(example.com)</title>
<script>
function displayResult(){
    var table=document.getElementById("myTable");
    alert(table.rows[0].cells[0].abbr);
}
</script>
</head>
<body>

<table id="myTable" border="1">
    <tr>
<td abbr="def">Keep the abbreviation short, browsers may repeat them.</td>
<td>Cell data</td>
    </tr>
<tr>
<td>Cell data</td>
<td>Cell data</td>
</tr>
</table>
<br>
<button type="button" onclick="displayResult()">Get the abbreviation of the first cell</button>

</body>
</html>

Try it Yourself »


td/th 对象参考手册td/th Object Other Extensions