2016-01-04 174 views
1

我正在使用最新的Firefox和IE 11工作的jquery插件,但在Ie9中失敗。我只是調試它,它似乎IE9失敗上線:什麼瀏覽器支持函數_now()?

var curr = _now(); 

其中IE9表示它不能識別_now();

我在哪裏可以看到哪些瀏覽器支持此功能?有沒有任何建議來取代上面的行,包括IE9的工作?

+0

var curr = new Date(); – Jaycee

+0

它在哪裏定義?原生javascript中沒有任何內容爲函數使用'_'前綴 – charlietfl

回答

2

還有沒有瀏覽器本機實現_now

爲了得到當前的日期,使用

var current = new Date(); 

get the current timestamp and support older JavaScript implementations,使用

var current = (new Date()).getTime(); 

get the current timestamp for ES5 and above,使用

var current = Date.now(); 

任何進一步的問題將是exclu與您正在使用的插件相關。它定義了_now並以IE9無法處理的方式進行處理。如果你需要繼續使用插件,你需要弄清爲什麼那個特定的插件正在破壞。