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中工作。有誰知道我該怎麼做?
你在哪裏調用函數? – vascowhite