日期:2014-05-17  浏览次数:20487 次

跨frame弹出窗口问题
有一个右下角弹出窗口的脚本写在main里面。只要切换页面,弹出窗口就不见了, 为避免这个问题不想在每个main框架内的页面都加上弹出窗口的脚本,也不方便维护.

有什么办法解决呢? 可以在写top里面在main框架显示弹出窗口吗?


HTML code
<frameset rows="50,30,*" frameborder="NO" border="0" framespacing="0">
  <frame src="top.html"  noresize="noresize" frameborder="NO" name="topFrame" scrolling="no" marginwidth="0" marginheight="0">
  <frame src="menu.html"  noresize="noresize" frameborder="NO" name="menu" scrolling="no" marginwidth="0" marginheight="0">
    <frameset cols="150,9,*" frameborder="no" border="0" framespacing="0" id="frame2">
      <frame src="left.html"name="leftFrame" noresize="noresize" marginwidth="0" marginheight="0" frameborder="0" scrolling="no"  target="main"> 
      <frame src="line.html" name="line" scrolling="no"  noresize="noresize">
      <frame src="main.html" name="main" marginwidth="0" marginheight="0" frameborder="0" scrolling="auto" target="_self">
    </frameset>
<noframes><body>
</body></noframes>


------解决方案--------------------
你可以在top里面通过下面的代码访问main

d = window.top.frames["main"].document;
div = document.createElement("div")
div.innerHTML = "xxx";
d.body.appendChild(div)

具体的细节自己添加吧。