<html>
<head>
<script type="text/javascript">
function getInnerHTML() {
alert(document.getElementById("tr1").innerHTML);
}
</script>
</head>
<body>
<table border="1">
<tr id="tr1">
<td>Firstname</td><td>Lastname</td>
</tr>
<tr id="tr2"><td>Peter</td><td>Griffin</td>
</tr>
</table>
<br />
<input type="button" οnclick="getInnerHTML()" value="Alert innerHTML of table row" />
</body>
</html>
弹出来的内容是:
<td>Firstname</td><td>Lastname</td>[color=black][/color][size=xx-small][/size][size=medium][/size][size=medium][/size][align=left][/align]
<head>
<script type="text/javascript">
function getInnerHTML() {
alert(document.getElementById("tr1").innerHTML);
}
</script>
</head>
<body>
<table border="1">
<tr id="tr1">
<td>Firstname</td><td>Lastname</td>
</tr>
<tr id="tr2"><td>Peter</td><td>Griffin</td>
</tr>
</table>
<br />
<input type="button" οnclick="getInnerHTML()" value="Alert innerHTML of table row" />
</body>
</html>
弹出来的内容是:
<td>Firstname</td><td>Lastname</td>[color=black][/color][size=xx-small][/size][size=medium][/size][size=medium][/size][align=left][/align]