nodeValue 屬性用于獲取節(jié)點(diǎn)值。您需要指定節(jié)點(diǎn)。
示例
您可以嘗試運(yùn)行以下代碼來了解如何獲取nodeValue屬性。
直播演示
<!DOCTYPE html>
<html>
<body>
<p>Get the node value</p>
<button>Demo Button Text</button>
<script>
var val = document.getElementsByTagName("BUTTON")[0];
var res = val.childNodes[0].nodeValue;
document.write("<br>Node Value: "+res);
</script>
</body>
</html>
登錄后復(fù)制
以上就是JavaScript HTML DOM中的nodeValue屬性是什么意思?的詳細(xì)內(nèi)容,更多請關(guān)注www.92cms.cn其它相關(guān)文章!






