我試圖在單擊時創建div contentEditable,然後在mouseout上將contentEditable設置爲false,但迄今爲止我還沒有成功。點擊一個鏈接出現,突出它,否則什麼事情都不:在點擊時切換contentEditable
<div id="content" contentEditable="true" onclick = "this.contentEditable = true;" onmouseout = "this.contentEditable = false;">
Surprisingly, <a href="http://google.com">clicking this link does nothing at all.</a> How can I fix this problem?
</div>
我預想的鏈接帶我去的鏈接頁面,當它被點擊,而是有人強調,當點擊並沒有做任何事情。我該如何解決這個問題?
事實證明,鏈接無法正常工作,即使它不是一個CONTENTEDITABLE DIV中。我想我已經找到了原因:http://stackoverflow.com/questions/15994328/clicking-a-link-has-no-effect-at-all –
安德森格林是正確的 - 這是因爲jsFiddle使用iFrames。另外一個使用類的通用解決方案在這裏:http://jsfiddle.net/dirkk0/8CNyw/ – dirkk0