在同一窗口中打开框架内的链接

Have Links inside the frame open in same window

本文关键字:框架 链接 窗口      更新时间:2023-09-26

在IE8上有一堆链接和Open directly, NextPrevious按钮。

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代码——导航框架是导航,其中的所有链接都应该在主框架内打开),当点击这些按钮时,这些代码会被调用,以直接移动到前进、前进或加载。问题是,这些链接打开的新窗口或新标签,但从来没有在同一个窗口。如果有人提供任何关于相同的建议,我将非常感谢。

在导航页面的每个链接上,您需要添加display框架的目标,或者最好将<base target="display">添加到test.jsp的头部部分。目标决定在哪里打开链接