链接会导致其他html选项卡跳转

时间:2018-11-19 20:39:47

标签: javascript html simultaneous fragment-identifier page-jump

我想同时打开两个浏览器窗口(或选项卡),显示text.html和note.html。单击text.html中的任何链接都不会打开新标签,而是会导致note.html页面跳至该链接;当我单击note.html时,情况就会相反。

但是在下面的页面中,每次我单击text.html中的不同链接(1 、、 ...,k)时,它都会打开一个新的浏览器标签。我不想传播新的选项卡,而是希望使note.html跳转(或滚动)到链接的片段标识符。如何做到这一点?

text.html:

<html>

    <p id="passage1">
    <a href="note.html#passage1" target="passage1" >note</a>
    Much text in passage1
    </p>    

    <p id="passagek">
    <a href="note.html#passagek" target="passage1" >note</a>
    Much text in passagek
    </p>    

</html>

note.html:

<html>

    <p id="passage1">
    <a href="text.html#passage1" target="passage1" >text</a>
    Note on passage1
    </p>    

    <p id="passagek">
    <a href="text.html#passagek" target="passagek" >text</a>
    Note on passagek
    </p>    

</html>

0 个答案:

没有答案