目前小弟在修改一個原本可在IE中運行的javascript想要使其在FireFox中也可順利運作,此特效主要目的是可以將左側的menu列隱藏起來,因為之前不是我做的,但現在要負責修改,找了一些IE與FF之Javascript相容性的文章,但卻還是不知道關鍵的修改點在哪裡,懇請高手幫我看一下,謝謝
Default.htm內容: --> 主要包了三個網頁,要修改的主要是menu那一頁
<frameset framespacing="0" border="0" frameborder="0" rows="33,*">
<frame name="title" id="title" src="title.aspx" scrolling="no" noresize marginwidth="0" marginheight="0">
<frameset cols="176,*">
<frame name="menu" id="menu" src="menu.aspx" marginwidth="0" marginheight="0" scrolling="no" noresize >
<frame name="main" id="main" src="main.aspx" scrolling="auto" >
</frameset>
<noframes>
<body>
<p>此網頁使用框架,但是您的瀏覽器不支援框架。</p>
</body>
</noframes>
</frameset>
menu頁面內容: -->主要是由此圖片驅動javascript動作
<img runat="server" id="imgOpen" src="Image/expand.gif" title="展開功能表" style="cursor: pointer; display: none;" onclick="Menubar_Show();" />
<img runat="server" id="imgClose" src="Image/close.gif" title="縮合功能表" style="cursor: pointer" onclick="Menubar_Hide();" />
Javascript內容: -->其中有一些我已改為getElementById,但關鍵的問題次乎在於FF不認識" fset.cols "這個屬性
<script language =javascript>
var miMaxWidth = 176; //功能選單最大寬度
var msFrameCols = miMaxWidth+",*"; //記錄選單顯示時 Frame 畫面比例
var miShowWidth = miMaxWidth; //選單頁的寬度
var mActiveGroup = 0;
function Menubar_Hide()
{
document.getElementById("imgClose").disabled = "true"
Menubar_HideStep();
document.getElementById("imgOpen").style.display="block";
document.getElementById("imgClose").style.display="none";
document.getElementById("imgOpen").disabled = ""
document.getElementById("imgClose").disabled = ""
}
function Menubar_HideStep()
{
var fset = window.top.document.getElementById("menu").offsetParent;
if (miShowWidth > 17)
{
miShowWidth -= 20;
fset.cols = miShowWidth+",*";
setTimeout("Menubar_HideStep()",20);
}
else
{
miShowWidth = 16;
fset.cols = miShowWidth+",*";
}
}
function Menubar_Show()
{
document.getElementById("imgOpen").disabled = "true"
Menubar_ShowStep();
document.getElementById("imgOpen").style.display="none";
document.getElementById("imgClose").style.display="block";
document.getElementById("imgOpen").disabled = ""
document.getElementById("imgClose").disabled = ""
}
function Menubar_ShowStep()
{
var fset = window.top.document.getElementById("menu").offsetParent;
if (miShowWidth < miMaxWidth)
{
miShowWidth += 20;
fset.cols = miShowWidth+",*";
setTimeout("Menubar_ShowStep()",20);
}
else
{
miShowWidth = miMaxWidth;
fset.cols = miShowWidth+",*";
}
}
</script>
|