【问题标题】:Scrolling down to an anchor in an HTML frame向下滚动到 HTML 框架中的锚点
【发布时间】:2014-02-17 22:35:06
【问题描述】:

我创建了一个由 6 帧组成的 HTML 文档:

  <xsl:result-document href="frameset.html" method="html">
    <html>
      <frameset cols="15%,*,15%">
         <frameset rows="100,*">
              <frame name="logo" src="logo.html"/>
              <frame name="menu" src="menu.html"/>
         </frameset>
         <frameset rows="100,*">
              <frame name="title" src="title.html"/>
              <frame name="content" src="content.html"/>
         </frameset>
         <frameset rows="100,*">
              <frame name="search" src="search.html"/>
              <frame name="links" src="links.html"/>
         </frameset>
     </frameset>
    </html>
   </xsl:result-document>

我想做的是,当用户单击 menu.html 中的链接时,会打开一个新的浏览器选项卡并显示相同的 6 帧。但是,content.html 框架将向下滚动到锚点。

我在下面尝试了这段代码,它会向下滚动到正确的位置,但它只会在新标签中给我一个框架。不是全部 6 个。

<a href="content.html#ID{$linkID}" target="_blank"><xsl:apply-templates/></a>

我在下面尝试了这段代码,它给了我所有 6 帧,但无法向下滚动到锚点。

<a href="frameset.html" target="_blank"><xsl:apply-templates/></a>

我需要一种方法将这两种东西合二为一。

【问题讨论】:

  • 尝试取出“{$linkID}” - 有什么作用?
  • @BruceWayne 这只会在新的浏览器选项卡中打开内容页面,而不是向下滚动到我想要的位置
  • 您想要动画向下滚动还是自动转到页面的特定部分
  • 试试“frameset.html#ID”
  • 它不需要动画。 frameset.html#ID 不会这样做。没有名为 ID 的锚点。并且锚点不在 frameset.html 中,它们在 content.html 中,这是 frameset.html 中框架内的 html 页面

标签: html xslt frameset


【解决方案1】:

首先,你真的有必要使用框架吗?您可能没有意识到这一点,但 HTML5 甚至不再支持它们。其次,如果这是一个真正的业务需要使用框架,并且绝对没有办法绕过它,如果我理解正确,那么您的链接将所有需要

<a href="frameset.html#ID{$linkID}" target="_blank"><xsl:apply-templates/></a>

【讨论】:

    猜你喜欢
    • 2015-06-28
    • 1970-01-01
    • 2020-10-17
    • 1970-01-01
    • 2012-01-24
    • 1970-01-01
    • 2017-11-10
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多