我试图创造
A.html:它包含链接(主题标题)
B.html:它在单个html文件中包含DIV中分离的各个主题的描述
B.html的大小非常大...因此,当我用B.html的div ID链接A.html时,它将加载整个B.html
我有什么办法可以同时链接A和B,以便A上的链接仅将B的链接DIV作为弹出窗口或在新选项卡中显示...
这是我正在使用的代码方法
A.html
<html>
<body>
<div>
<a href="B.html#div1" rel="nofollow" target="_blank"/>Link to Topic in Page B</a>
</div>
</body>
B.html
<html>
<body>
<div id="div1">
Description of Topic A
</div>
<div id="div2">
Description of Topic B
</div>
<div id="div3">
Description of Topic C
</div>
<div id="div4">
Description of Topic D
</div>
</body>
最佳答案
使用iframe标记可以在单独的标签中打开B.html的一部分或从A.html进行显示,但是如果要显示特定的div,我认为您需要使用javascript:请参见Load content of a div on another page
关于javascript - 如何从一个html链接并显示第二个html中存在的多个div的单个div?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/32820050/