js对象的innerHTML属性

<html>  

<head>  

<scripttype="text/javascript">  

functiongetInnerHTML(){  

alert(document.getElementById("tr1").innerHTML);  

}  

</script>  

</head>  

<body>  

<tableborder="1">  

<trid="tr1">

<td>Firstname</td><td>Lastname</td>

</tr>  

<trid="tr2"><td>Peter</td><td>Griffin</td>

</tr>  

</table>  

<br/>  

<inputtype="button"onclick="getInnerHTML()"value="AlertinnerHTMLoftablerow"/>  

</body>  

</html>

弹出来的内容是:

<td>Firstname</td><td>Lastname</td>[color=black][/color][/size][size=medium][size=medium][/size][align=left][/align]

相关推荐