gpt4 book ai didi

html - 如何在同一页面的 div 中定位 anchor

转载 作者:太空宇宙 更新时间:2023-11-04 15:23:46 25 4
gpt4 key购买 nike

我正在努力将一些 anchor /其他 html 页面(左侧的按钮)显示在同一页面的另一个 div 中(更准确地说是在右侧)。 div 有什么解决方案吗?或者可能使用 frame/iframe,甚至 jQuery 有什么提示吗?

In the image you've got the source code

最佳答案

Are there any solutions to this with div?

  1. 使用 JavaScript 获取内容(例如 XMLHttpRequest)。
  2. 去掉不需要的部分(例如,除了 <body> 的内容之外的所有内容
  3. 使用 DOM 操作将其添加到 div

Or maybe with frame/iframe

这正是 iframe 的设计目的。设置 target name 的 anchor 属性的 iframe


将内容加载到页面的一部分会遇到很多问题。至少它会干扰访问者链接到他们实际查看的内容的能力(尽管您可以使用 History API 和 pushState 来弥补这一点)。只链接到一个新页面几乎总是一个更好的主意,该页面包含(通过模板)所有页面共有的任何内容。

关于html - 如何在同一页面的 div 中定位 anchor ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14278045/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com