innerText与innerHTML的区别:
<html>
<head>
<title>document示例</title>
<scriptlanguage="javascript" type="text/javascript">
<!--
function test1(){
//innerText作为文本解析
document.getElementById("myspan").innerText="<ahref='http://www.sohu.com'>转到sohu</a><br>";
}
function test2(){
//innerHTML作为html解析
document.getElementById("myspan").innerHTML="<ahref='http://www.sohu.com'>转到sohu</a><br>";
}
//-->
</script>
</head>
<body>
<spanid="myspan"></span><br>
<input type="button"value="测试innerText" οnclick="test1()" />
<input type="button"value="测试innerHTML" οnclick="test2()" />
</body>
</html>