DOM HTML td / th abbr atributo
TD / objetos th
Definición y Uso
abbr conjuntos de propiedades o devuelve el cubo en una versión abreviada (por medios no visuales tales como el habla y en braille).
Si se establece este atributo, el usuario puede oír los valores (no el contenido de células) abbr atributo.
gramática
Configuración abbr atributo:
tdObject.abbr="text"
或者
thObject.abbr="text"
或者
thObject.abbr="text"
Volver abbr atributo:
tdObject.abbr
或者
thObject.abbr
或者
thObject.abbr
Consejo: abbr atributo no tiene ningún valor predeterminado.
Soporte para el navegador
Todos los principales navegadores soportan el atributo abbr.
Ejemplos
Ejemplos
El siguiente ejemplo le pide al primer abbr celular ::
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>本教程(w3big.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">保持名称简短的缩写,浏览器可能重复显示它们。</td>
<td>单元格数据</td>
</tr>
<tr>
<td>单元格数据</td>
<td>单元格数据</td>
</tr>
</table>
<br>
<button type="button" onclick="displayResult()">获取第一个单元格的缩写</button>
</body>
</html>
<html>
<head>
<meta charset="utf-8">
<title>本教程(w3big.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">保持名称简短的缩写,浏览器可能重复显示它们。</td>
<td>单元格数据</td>
</tr>
<tr>
<td>单元格数据</td>
<td>单元格数据</td>
</tr>
</table>
<br>
<button type="button" onclick="displayResult()">获取第一个单元格的缩写</button>
</body>
</html>
Trate »
TD / objetos th