createTextRange innerText
createTextRange pasteHTML
var e=document.body.createTextRange();
e.pasteHTML("HELLO,WORLD");
alert(e.text) or alert(e.htmlText);
innerText
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>
<body>
<div onmouseover="show(this)">第一个层</div>
<div onmouseover="show(this)">第二个层</div>
<div onmouseover="show(this)">第三个层</div>
<div onmouseover="show(this)">第四个层</div>
<div onmouseover="show(this)">第五个层</div>
<div id="div1">第六个层</div>
<script type="text/javascript">
var div1=document.getElementById("div1")
function show(he){
div1.innerText=he.innerText;
}</script>
</body>
</html>

浙公网安备 33010602011771号