我正在尝试做:
document.getElementById("header-text").innerHTML = "something interesting";
它适用于除 Opera 之外的所有浏览器(我正在运行最新版本)。
浏览互联网时,我发现有人说 Opera 不支持 innerHTML。这听起来不对。
任何指针?
谢谢
编辑:这是我想要得到的 id
<div id="header-text" class="picture-text">
<!--[if gt IE 5]>ugly hack<![endif]-->
Some text generated server side
<!--[if gt IE 5]>ugly hack<![endif]-->
</div>
Edit2:我有同样的问题:
<div id="header-text" class="picture-text">
Static text
</div>
编辑3:
<body onload="intialize();">
function intialize() {
operaHeaderFix();
}
function operaHeaderFix(){
if(window.opera) {
/*opera specific action*/
document.getElementById("picture-line-wrapper").style.position="relative";
document.getElementById("picture-line-wrapper").style.top="0px";
document.getElementById("picture-line-wrapper").style.marginTop="-230px";
document.getElementById("picture-line").style.padding="1px";
document.getElementById("header-text").innerHTML = "<div style='margin:220px 0px 0px 20px;'>"+document.getElementById("header-text").innerHTML+"TEST</div>";
}
}
Edit4:如果我删除 if(window.opera),它将在 FF 和 IE 中运行良好