案例:javascript案例     状态:可编辑再运行    进入竖版
 运行结果 
x
 
1
<html>
2
<head>
3
<script type="text/javascript">
4
function alertAxis()
5
  {
6
  alert(document.getElementById('td3').axis);
7
  }
8
</script>
9
</head>
10
<body>
11
12
<table border="1">
13
<tr>
14
<th>Firstname</th>
15
<th>Lastname</th>
16
<th>City</th>
17
</tr>
18
<tr>
19
<td id="td1">Harry</td>
20
<td id="td2">Potter</td>
21
<td id="td3" axis="location">NY</td>
22
</tr>
23
<tr>
24
<td id="td4">Peter</td>
25
<td id="td5">Griffin</td>
26
<td id="td6" axis="location">Las Vegas</td>
27
</tr>
28
</table>
29
<br />
30
<input type="button" onclick="alertAxis()" value="Alert axis" />
31
32
</body>
33
</html>
34