1.innerHTML Sets or retrieves the HTML between the start and end tags of the object;
2.outerHTML Sets or retrieves the object and its content in HTML;
3.innerText Sets or retrieves the text between the start and end tags of the object;
4.outerText Sets or retrieves the text of the object.

<div id="div"><input name="button" value="Button" type="button"><font color="green"><h2>This is a DIV!</h2></font></div><input name="innerHTML" value="innerHTML" type="button" OnClick="alert(div.innerHTML);"> <input name="outerHTML" value="outerHTML" type="button" OnClick="alert(div.outerHTML);"> <input name="innerText" value="innerText" type="button" OnClick="alert(div.innerText);"> <input name="outerText" value="outerText" type="button" OnClick="alert(div.outerText);">

运行一下上面的代码就知道它们的区别所在了 :

This is a DIV!


分享到饭否

html | 评论(0) | 引用(20) | 阅读(2911)
发表评论
表情
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
打开HTML
打开UBB
打开表情
隐藏
昵称   密码   游客无需密码
网址   电邮   [注册]
               

验证码 请输入左侧的字母,不区分大小写