value innerText innerHtml的区别

来源:互联网 发布:网络化妆课程 编辑:程序博客网 时间:2024/05/24 02:39

innerText和innerHtml是用于在页面上输出现实的信息的。

也就是说在js里:var tt=xxx.innerText, tt是空的,要用xxx.value.

例如:

<html><head><script>function show(){var obj = document.getElementById("d");d.innerText="show text";}function message(){var obj = document.getElementById("e");alert(obj.value)}</script></head><body><div id="d" onClick="show()" >abc</div><input type="text" id="e" value="" onBlur="message()"/></body></html>
对比看看

原创粉丝点击