2011-02-24 94 views
1

我有一個div,我想找到當前焦點節點(元素)在div爲ie。對於Firefox和Chrome,我使用選擇屬性獲得焦點節點。即沒有這種屬性。如何獲得焦點節點即

selection.focusNode

請給你的想法。提前致謝。

回答

3

嘗試:

document.activeElement 

DEMO

+0

這起源於IE,但也支持最新版本的其他瀏覽器。 – 2011-02-24 10:13:56

+0

也在鉻和FF中進行了測試 – qwertymk 2011-02-24 13:20:41