日期:2014-05-16  浏览次数:20615 次

鼠标右键新窗口打开问题
A页面中有一个导航条和iframe框架,点击导航条的链接在iframe中显示B页面,可是当我鼠标右键新窗口中打开导航条链接时,弹出的页面只是单独的B页面,我想弹出的页面是B页面在A页面里的iframe中显示。哪位大哥能帮帮忙。谢谢!

------解决方案--------------------
引用:
B页面代码判断一下,如果页面未在iframe中,就跳转到A页面并地址栏参数传递当前页面标识

不过这样页面会闪一下,体验欠佳

更好的做法是:
链接指向A页面并地址栏参数传递该链接的B页面地址,这样新页面打开就会打开A页面,判断一下加载相应的B页面
然后链接添加onclick事件,修改iframe的src,并返回false,这样点击链接页面不会跳转
------解决方案--------------------
<frameset rows="64,*"  frameborder="NO" border="0" framespacing="0">
<frame src="index.html&id=000" noresize="noresize" frameborder="0" name="topFrame" scrolling="no" marginwidth="0" marginheight="0" target="main" />
<frameset cols="200,*"  rows="800,*" id="frame">
<frame src="index.html&id=001" name="leftFrame" noresize="noresize" marginwidth="0" marginheight="0" frameborder="0" scrolling="no" target="main" />
<frame src="index.html&id=002" name="main" marginwidth="0" marginheight="0" frameborder="0" scrolling="auto" target="_self" />
</frameset>
</frameset>
主要是name和target的问题