1
我在Wordpress中安裝了一個插件。插件名稱是很好的背景音樂。除了使用Safari之外,該插件可以在所有瀏覽器上工作:聲音不播放,按鈕暫停不起作用。JavaScript插件在Safari中不工作
的錯誤是:
類型錯誤未定義是不是一個函數
(評估_this.audio_player_element.pause()')
這個鏈接下載文件JS
我在Wordpress中安裝了一個插件。插件名稱是很好的背景音樂。除了使用Safari之外,該插件可以在所有瀏覽器上工作:聲音不播放,按鈕暫停不起作用。JavaScript插件在Safari中不工作
的錯誤是:
類型錯誤未定義是不是一個函數
(評估_this.audio_player_element.pause()')
這個鏈接下載文件JS
1)因爲有.attr(),我假設你使用jQuery 你可能會使用多個jquery腳本(彼此競爭)。
2)因爲存在_這是你的範圍,你實際上可能會調用超出範圍的對象。 3)如果你使用的腳本不適用於Safari,那麼這就是發生了什麼。
if(_this.audio_player_element.paused)
{
//you will never reach this because audio_player_element is undefined which gives false due to your scope or being taken by another jquery $ script
}
else
{
//you will always end up here, and you are trying to pause() the undefined.
}
我有粘貼鏈接下載文件js。 –
'_this'定義在哪裏? –
開始代碼javascript
war_SoundyFrontEnd.prototype.initPPButton = function() { \t var _this = this;
–請修改您的問題以添加展開的代碼段,而不是在評論中添加代碼 –