td/th axisPropiedad
Objeto td/th
Definición y uso
La propiedad axis establece o devuelve una lista separada por comas que contiene un conjunto de nombres de tipos (celdas relacionadas).
Sintaxis
Establecer la propiedad axis:
tdObject.axis="text"
o
thObject.axis="text"
o
thObject.axis="text"
Devolver la propiedad axis:
tdObject.axis
o
thObject.axis
o
thObject.axis
Consejo:La propiedad axis no tiene valor predeterminado.
Soporte del navegador
![]()
![]()
![]()
![]()
![]()
Todos los navegadores principales admiten la propiedad axis.
Ejemplo
Ejemplo
El siguiente ejemplo devuelve el axis de la celda:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Ejemplo (example.com)</title>
<script>
function displayResult(){
var x=document.getElementById("myTable");
var th=x.getElementsByTagName("th");
for (var i=0;i<th.length;i++){
alert ("The " + (i+1) + ". column axis is: " + th[i].axis);
}
}
</script>
</head>
<body>
<table border="1" id="myTable">
<tr>
<th axis="car">Nombre</th>
<th axis="country">País</th>
</tr>
<tr>
<td>BMW</td>
<td>Germany</td>
</tr>
<tr>
<td>Volvo</td>
<td>Sweden</td>
</tr>
<tr>
<td>Saab</td>
<td>Sweden</td>
</tr>
</table>
<br>
<button type="button" onclick="displayResult()">Obtener Axis</button>
</body>
</html>
<html>
<head>
<meta charset="utf-8">
<title>Ejemplo (example.com)</title>
<script>
function displayResult(){
var x=document.getElementById("myTable");
var th=x.getElementsByTagName("th");
for (var i=0;i<th.length;i++){
alert ("The " + (i+1) + ". column axis is: " + th[i].axis);
}
}
</script>
</head>
<body>
<table border="1" id="myTable">
<tr>
<th axis="car">Nombre</th>
<th axis="country">País</th>
</tr>
<tr>
<td>BMW</td>
<td>Germany</td>
</tr>
<tr>
<td>Volvo</td>
<td>Sweden</td>
</tr>
<tr>
<td>Saab</td>
<td>Sweden</td>
</tr>
</table>
<br>
<button type="button" onclick="displayResult()">Obtener Axis</button>
</body>
</html>
Pruébalo »
Objeto td/th
Otras extensiones