Re: [ js ] 怎麼辨識出HTML中的
在 MozTW 問到答案了 http://forum.moztw.org/viewtopic.php?t=27421
"A\u00a0B"==document.getElementById('space').firstChild.nodeValue
為true,詳見 MozTW 討論串。
※ 引述《shyangs (欲翔)》之銘言:
: 我想用 js 辨識 HTML 中的一個文字節點,該節點含有
: 簡單的例子
: <html>
: <span id="space">A B</span>
: </html>
: 我試過
: javascript:alert('A B'==document.getElementById('space').firstChild.nodeValue)
: javascript:
: alert('A B'==document.getElementById('space').firstChild.nodeValue)
:
: javascript:alert('A%20B'==document.getElementById('space').firstChild.nodeValue)
:
: javascript:
: alert('A\u0020B'==document.getElementById('space').firstChild.nodeValue)
: 答案都是false,怎樣寫才會是true
: 環境:Fx3.5、xp sp3
: 謝謝。
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 218.175.199.170
推
07/16 10:37, , 1F
07/16 10:37, 1F
推
07/16 21:36, , 2F
07/16 21:36, 2F
討論串 (同標題文章)
本文引述了以下文章的的內容:
完整討論串 (本文為第 2 之 2 篇):