有这样的HTML:
<h1 class="title">NOW ZINC PICOLINATE 50MG 60caps CYNK PIKOLINIAN
<small>(6826446676)</small>
</h1>
我想只得到这个:“NOW ZINC PICOLINATE 50MG 60caps CYNK PIKOLINIAN”
当我使用时:
HTMLDoc.getElementsByTagName("h1")(0).innerText
我得到:“NOW ZINC PICOLINATE 50MG 60caps CYNK PIKOLINIAN(6826446676)”
答案 0 :(得分:1)
HTMLDoc.getElementsByTagName("h1")(0).childNodes(0).nodeValue
' /|\
' All nodes, including #text -------|