[英]Link to section within an embedded page's content
I have a Microsoft Word document exported as a web page that I need to be displayed as contents for a help page in my browser-based system. 我有一个导出为网页的Microsoft Word文档,需要将其显示为基于浏览器的系统中帮助页面的内容。 This help page includes a table of contents and a simplified search engine, all of which will involve linking to sections of the document.
该帮助页面包括目录和简化的搜索引擎,所有这些都将涉及到文档各部分的链接。 Right now, we've the basic functionality nailed down with the general form below:
现在,我们将基本功能与以下常规形式联系在一起:
<!-- Our code -->
<a href="#heading">Heading Name</a>
<div>Summary of section</div>
<!-- Exported from Word -->
<div id="heading">Heading Name</div>
<div>Section content</div>
In the above implementation, we are directly modifying the exported document. 在以上实现中,我们直接修改导出的文档。 For maintainability, we want to move our code to a separate page and embed the exported document inside this new page, either using
<embed>
or <iframe>
. 为了实现可维护性,我们想使用
<embed>
或<iframe>
将代码移动到单独的页面,并将导出的文档嵌入到新页面中。 That way, changes to code and changes to the Word document's content can be made independent of and without affecting the other. 这样,可以使代码更改和Word文档内容的更改独立于彼此,而不会影响彼此。 For example:
例如:
<!-- Our code -->
<a href="#heading">Heading Name</a>
<div>Summary of section</div>
<iframe>
<!-- iframe contents - document exported from Word -->
...
<div id="heading">Heading Name</div>
<div>Section content</div>
...
</iframe>
How can I get the linking to work again? 如何使链接重新起作用?
U can assign ID for iframe 您可以为iframe分配ID
<iframe id="heading">
Or u can use JS and using offset().top function for scroll to needed position on click. 或者,您可以使用JS并使用offset()。top函数在单击时滚动到所需位置。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.