2011-12-01 67 views
0

我曾嘗試使用下面的代碼中聲明HTML中的對象:如何在Safari中更新HTML對象數據並輸入Javascript?

<object type="text/plain" id="clueBox" data="clues/random.txt" height="315" width="560"></object> 

然後在我的JavaScript我有一個看起來像這樣的功能:

function dummy(){ 
    var box = document.getElementById("clueBox"); 

    //alert(currentClue + " " + clueTypes[clueNum]); 
    box.setAttribute("type", "text/plain"); 
    box.setAttribute("data", "clues/clue0.txt"); 
    alert("Called Dummy"); 

} 

調用此函數應該更新HTML中的clueBox對象。它在Firefox中完美運行,但在Safari中完全不起作用。我需要讓它在Safari中工作。有誰知道我該怎麼做?

+0

你在哪裏調用函數? – vascowhite

回答

1

我的代碼沒有問題。我會在Safari中檢查你的錯誤控制檯,看看是否有JavaScript錯誤。您可以通過按Ctrl + Alt + C打開它。你的戒備也被解僱了嗎?

相關問題