实例1.
<a href="#" onclick="alert(this.innerHTML)">this is innerHTML</a><br>
<a href="#" onclick="alert(this.outerHTML)">this is outerHTML</a><br>
实例2.
<a href="#" onclick="this.innerHTML='<p onclick=alert(this.outerHTML)>this is outerHTML</p>' ">this is innerHTML</a>
实例3.
<button onclick=alert(obj1.innerHTML)>obj1.innerHTML</button>
<button onclick=alert(obj2.outerHTML)>obj2.outerHTML</button>
<div id=obj1><font color=blue>cnbruce</font></div>
<div id=obj2><font color=red>cnrose</font></div>
实例4.
<SELECT NAME="cn_who">
<option value="male">cnbruce</option>
<option value="female">cnrose</option>
</SELECT>
<INPUT TYPE="button" VALUE="The Node" onClick="alert(cn_who.children[0].nodeName)">
<INPUT TYPE="button" VALUE="The Name" onClick="alert(cn_who.children[0].innerText)">
<INPUT TYPE="button" VALUE="The Sex" onClick="alert(cn_who.children[0].value)">
<INPUT TYPE="button" VALUE="The Node" onClick="alert(cn_who.children[1].nodeName)">
<INPUT TYPE="button" VALUE="The Name" onClick="alert(cn_who.children[1].innerText)">
<INPUT TYPE="button" VALUE="The Sex" onClick="alert(cn_who.children[1].value)">
实例5.
<a href="#" onclick="this.insertAdjacentText('afterEnd',' cnbruce ')">insertAdjacentText</a>
posted on 2006-06-21 17:33
kelven 阅读(455)
评论(0) 编辑 收藏 所属分类:
JavaScript