如何解決frameset 在 Google Chrome 中無法隱藏左邊欄的問題?
這篇文章帶給大家的內容是介紹解決frameset 在 Google Chrome 無法隱藏左邊欄問題的方法 。有一定的參考價值,有需要的朋友可以參考一下,希望對你們有幫助。
使用Frameset 框架,發現在IE下,
<frameset name="mainDefine" cols="200,10,*" frameborder="NO" border="0" framespacing="0" rows="*"> <frame name="LeftFrame" noresize scrolling="auto" src="<%= PageTitle %>" > <frame name="middleFrame" scrolling="NO" noresize src="switchBar.html"> <frame name="mainFrame" id ="mainFrame" scrolling="auto" noresize src="AddTabs.aspx"> </frameset>
switchBar.html 页面中,可以使用js 控制左边栏的显示、隐藏
function oa_tool() { if (window.parent.mainDefine.cols == "0,10,*") { frameshow.src = "p_1.gif"; oa_tree.title = "隐藏工具栏" window.parent.mainDefine.cols = "200,10,*"; } else { frameshow.src = "p_2.gif"; oa_tree.title = "显示工具栏" window.parent.mainDefine.cols = "0,10,*"; } }
<p id="oa_tree" onclick="oa_tool();" title="隐藏工具栏"><br> <img id="frameshow" src="p_1.gif"> </p>
但是在 Google Chrome 中,會報錯情況:
無法讀取cols屬性。
解決方案:
<frameset id="mainDefine" name="mainDefine" cols="200,10,*" frameborder="NO" border="0" framespacing="0" rows="*"> <frame name="LeftFrame" noresize scrolling="auto" src="<%= PageTitle %>" > <frame name="middleFrame" scrolling="NO" noresize src="switchBar.html"> <frame name="mainFrame" id ="mainFrame" scrolling="auto" noresize src="AddTabs.aspx"> </frameset>
Frameset 新增ID,在JS 使用 document.getElementById 來取得ID 的 cols
if (parent.document.getElementById('mainDefine').cols == "0,10,*") { frameshow.src = "p_1.gif"; oa_tree.title = "隐藏工具栏" parent.document.getElementById('mainDefine').cols = "200,10,*"; } else { frameshow.src = "p_2.gif"; oa_tree.title = "显示工具栏" parent.document.getElementById('mainDefine').cols = "0,10,*"; }
以上是如何解決frameset 在 Google Chrome 中無法隱藏左邊欄的問題?的詳細內容。更多資訊請關注PHP中文網其他相關文章!

熱AI工具

Undresser.AI Undress
人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover
用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool
免費脫衣圖片

Clothoff.io
AI脫衣器

AI Hentai Generator
免費產生 AI 無盡。

熱門文章

熱工具

記事本++7.3.1
好用且免費的程式碼編輯器

SublimeText3漢化版
中文版,非常好用

禪工作室 13.0.1
強大的PHP整合開發環境

Dreamweaver CS6
視覺化網頁開發工具

SublimeText3 Mac版
神級程式碼編輯軟體(SublimeText3)

熱門話題

本文討論了在瀏覽器中優化JavaScript性能的策略,重點是減少執行時間並最大程度地減少對頁面負載速度的影響。

本文討論了使用瀏覽器開發人員工具的有效JavaScript調試,專注於設置斷點,使用控制台和分析性能。

Python和JavaScript開發者的薪資沒有絕對的高低,具體取決於技能和行業需求。 1.Python在數據科學和機器學習領域可能薪資更高。 2.JavaScript在前端和全棧開發中需求大,薪資也可觀。 3.影響因素包括經驗、地理位置、公司規模和特定技能。

本文說明瞭如何使用源地圖通過將其映射回原始代碼來調試JAVASCRIPT。它討論了啟用源地圖,設置斷點以及使用Chrome DevTools和WebPack之類的工具。

如何在JavaScript中將具有相同ID的數組元素合併到一個對像中?在處理數據時,我們常常會遇到需要將具有相同ID�...

深入探討console.log輸出差異的根源本文將分析一段代碼中console.log函數輸出結果的差異,並解釋其背後的原因。 �...
