在同一窗口中打开框架内的链接
在 IE8 上有一个包含一堆链接的下拉菜单以及直接打开
、下一步
和上一步
按钮。
var count = -1
var total = 24
function goToNext()
{
count = parent.nav.openfile.file.selectedIndex
count ++
if (count > total)
count = 0;
parent.display.location= parent.nav.openfile.file.options[count].value
parent.nav.openfile.file.selectedIndex = count
}
function goToPrevious()
{
count = parent.nav.openfile.file.selectedIndex
count --
if (count < 0)
count = total;
parent.display.location=parent.nav.openfile.file.options[count].value
parent.nav.openfile.file.selectedIndex = count
}
function LoadFirst()
{
parent.display.location=parent.nav.openfile.file.options[0].value
}
function OpenDirectly()
{
parent.display.location = parent.nav.openfile.file.options[parent.nav.openfile.file.selectedIndex ].value
}
<FRAMESET ROWS="45,*">
<FRAME
BORDER="1"
FRAMEBORDER="YES"
MARGINHEIGHT="10"
MARGINWIDTH="10"
NAME="nav"
SCROLLING="NO"
SRC="/Slide/test.jsp"
/>
<FRAME
BORDER="1"
FRAMEBORDER="YES"
MARGINHEIGHT="10"
MARGINWIDTH="10"
NAME="display"
ID="display"
SCROLLING="AUTO"
SRC="/page.html"
/>
</FRAMESET>
上面是代码(test.jsp,后跟包含主框架和导航框架的 HTML 代码 - 导航框架是导航,其中的所有链接都应在主框架内打开),单击这些按钮向前移动时将调用该代码,上一个或直接加载。问题是这些链接在新窗口或新选项卡中打开,但从未在同一窗口中打开。如果有人提供任何类似的建议,我将不胜感激。
Have a dropdown with a bunch of links alongwith Open directly
, Next
and Previous
buttons on IE8.
var count = -1
var total = 24
function goToNext()
{
count = parent.nav.openfile.file.selectedIndex
count ++
if (count > total)
count = 0;
parent.display.location= parent.nav.openfile.file.options[count].value
parent.nav.openfile.file.selectedIndex = count
}
function goToPrevious()
{
count = parent.nav.openfile.file.selectedIndex
count --
if (count < 0)
count = total;
parent.display.location=parent.nav.openfile.file.options[count].value
parent.nav.openfile.file.selectedIndex = count
}
function LoadFirst()
{
parent.display.location=parent.nav.openfile.file.options[0].value
}
function OpenDirectly()
{
parent.display.location = parent.nav.openfile.file.options[parent.nav.openfile.file.selectedIndex ].value
}
<FRAMESET ROWS="45,*">
<FRAME
BORDER="1"
FRAMEBORDER="YES"
MARGINHEIGHT="10"
MARGINWIDTH="10"
NAME="nav"
SCROLLING="NO"
SRC="/Slide/test.jsp"
/>
<FRAME
BORDER="1"
FRAMEBORDER="YES"
MARGINHEIGHT="10"
MARGINWIDTH="10"
NAME="display"
ID="display"
SCROLLING="AUTO"
SRC="/page.html"
/>
</FRAMESET>
Above is the code(test.jsp followed by the HTML code containing main frame and navigation frame - the navigation frame is navigation and all the links within it should open within the main frame) which gets called on click of these buttons to move forward, previous or load directly. The issue is that these links open in either new window or new tab but never in same window. Would highly appreciate if anyone provides any recommendations around the same.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在导航页面的每个链接上,您需要添加
display
框架的目标,或者更好地将
添加到 < 的 head 部分代码>test.jsp。目标决定在哪里打开链接。On every link of navigation page, you need to add the target of the
display
frame or better add<base target="display">
to the head section oftest.jsp
. The target decides where to open the link in.