2011-12-01 68 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打开它。你的戒备也被解雇了吗?

相关问题