我試圖在突出顯示特定文本時顯示隱藏的DIV標記。我能得到一個隱藏的div顯示凸顯,但2個部分,我不能做到是:突出顯示特定的文字時(我假設使用span標籤ID或類似的東西)在高亮顯示DIV然後隱藏
只顯示
將顯示更改爲阻止後,5秒後將其更改爲隱藏。
這是我的嘗試。再一次,這確實顯示了突出顯示的隱藏分區,但這是我得到的。請幫忙!
function ShowNote() {
document.getElementById('Note').style.display = 'block';
}
document.onmouseup = ShowNote;
if (!document.all) document.captureEvents(Event.MOUSEUP);
function HideNote() {
document.getElementById('Note').style.display = 'hidden';
}
setTimeout("HideNote()", 5000); // after 5 secs
I DON'T want it to show when I highlight this text
<br />I DO want it to show when I highlight this text.
<div type='text' id='Note' style="display:none;">HIDDEN DIV CONTENT</div>
你在瀏覽器中得到什麼錯誤?拋出一個快速的jsfiddle,但我現在可以說,用這個代碼你會得到'未捕獲的引用錯誤:未定義隱藏註冊'的錯誤。 –
[看這裏](http://stackoverflow.com/a/3545105/1891677),可能還有它上面的那個。 –
'style.display ='hidden''無效。你想要'style.display ='none';' –