1. 程式人生 > >div彈出視窗在frameset外層解決方案

div彈出視窗在frameset外層解決方案

首頁通過framset經行網頁佈局,現在有個臨時的訊息視窗,ajax返回會彈出來。但是這個就有問題了。div作為網頁元素,是依賴與frame的。怎麼讓其在整個檢視視窗的最上層呢? frmae 連線網頁,會對超過的部分進行遮擋。這裡提供了一種解決方案.先記錄下來。

<html>
<head>
<title>index.jsp</title>
</head>
<frameset rows="*" marginheight="0" marginwidth="0" topmargin="0" leftmargin="0">
       <frame name="divframe" src="call.html" marginheight="0" marginwidth="0" topmargin="0" leftmargin="0" noresize scrolling="no">
</frameset>
<noframes>
<body>
sorry your browser doesn't accept frames
</body>
</noframes>
</html>

首頁div需要覆蓋的frame 放到引入的頁面裡,用iframe呼叫。

---call.html---

<html>
<body>
        <div id='popId' class='' style="position:absolute;float:left;top=5;left=25;display='none';z-index:2;"> 彈出div</div>
        <iframe src="mainindex.html" width=100% height=100% marginwidth=0>
</body>
</html>

--mainindex.html--

<frameset rows="30,*" style="z-index:1">
          <frame src="topframe.html" style="z-index:1">
   <frameset cols="30,*" style="z-index:1"> 

        <frame src="menuframe.html" style="z-index:1">
        <frame src="mainframe.html" style="z-index:1">

  </frameset>
      <frame src="footframe.html" style="z-index:1">
</frameset>

    js 動作

   <a onclick="top.divframe.document.getElementById('popId').style.display='block'">顯示DIv</a>

  --the  end!