javascript 在Firefox3.5下失效

来源:百度知道 编辑:UC知道 时间:2024/06/22 08:07:42
我写了以下javascript语句,在ie8下正常。在firefox3.5下不起作用。
parent.document.getElementById('left').contentWindow.location = "/website/?q=" + document.inputform1.elements["query"].value;
请问应当怎样写才能兼容ie和firefox呢?谢谢各位大侠了!

parent.document.getElementById('left')是什么?如果你是重置parent的url的话,使用:parent.location="....";就行了。如果是parent.document.getElementById('left')是iframe,用parent.frames['left'].location='...';

window.top.frames['left'].location.href = '网址';

用 document.href.location