js对象的innerHTML属性

owhile 2012-08-17

<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]

相关推荐

swiftwwj / 0评论 2019-12-29