innerHTML 例子
innerHTML 属性设置或返回表格行的开始和结束标签之间的 HTML。
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>Hello,yang</title>
<style type="text/css">
li{
font-size:12px;
cursor:pointer}
p{
font-size:16px;
font-family:Verdana, Arial, Helvetica, sans-serif;
color:#FF0000;
}
</style>
</head>
<script type="text/javascript">
function changename(){
var name = document.getElementById("name");
name.innerText="<p>李杨</p>";
}
function changeold(){
var old = document.getElementById("old");
old.innerHTML="<p>27岁了</p>";
}
</script>
<body>
<ul>
<li onClick="changename()" id=name>你叫什么名字?</li>
<li onClick="changeold()" id=old>你多大了?</li>
</ul>
</body>
</html>