0
不確定我有以下功能:event.type在Firefox
format : function(element,p){
//function body
if(event.type == 'focus'){
//execute this condition only on focus event
}
}
正被呼籲的焦點事件,並在頁面加載。元素是輸入元素的值,p是一個可選的參數,我想執行if只在輸入元素上的焦點。如果我簡單地應用event.type =='focus',它適用於IE和Chrome,但是對於Firefox來說它說事件沒有被定義。
有沒有人有這方面的解決方法?提前致謝。
您尚未爲函數定義'event'參數,並且FF沒有全局'window.event'對象。 – 2014-10-27 19:32:36
Firefox不提供當前事件對象作爲全局變量。你必須將它傳遞給事件處理程序的函數。 – 2014-10-27 19:32:53