我在更改焦點時更改iframe內容。它適用於FF,但focus
和blur
事件不會在Google Chrome中觸發!Chrome瀏覽器不會觸發內容中文檔的焦點和模糊事件可編輯iframe
var iframe = $('#iframe').get(0);
iframe.onload = function(){
iframeDoc = $(iframe.contentWindow.document);
iframeDoc.focus(function(){
alert('focused');
}).blur(function(){alert('blur');
alert('blured');
});
}
然而,其他事件一樣keyup
,keypress
正在工作。你知道有什麼問題以及如何處理?
託管在同一個域中的iframe的內容? –
@StevenV是的,它託管在相同的域名 – Omid