cph*_*pot 23 html javascript innerhtml
我创建了一个电子邮件链接,可以自动填充正文中的必要信息.但是,当我这样做时,我会得到比我讨价还价更多的东西.
我想要"2012年3月:12-16"
我得到了什么 <B>March, 2012</B>: <FONT color=blue>12</FONT> - <FONT color=blue>16</FONT>
有没有办法在没有html标签的情况下获取innerHTML?
.value = undefined
.text = undefined
Run Code Online (Sandbox Code Playgroud)
aps*_*ers 39
你想要.textContent除了旧的IE以及.innerTextIE(<9).
所以,试试:
string = (node.textContent===undefined) ? node.innerText : node.textContent;
编辑:或者,只是使用GGG更清洁string = (node.innerText || node.textContent),因为undefined是假的.
| 归档时间: |
|
| 查看次数: |
39591 次 |
| 最近记录: |