gpt4 book ai didi

javascript - 将链接设置为等于上次单击的链接

转载 作者:行者123 更新时间:2023-11-30 11:16:17 25 4
gpt4 key购买 nike

我正在尝试建立一个链接,该链接将返回到一个特定链接,该链接等于在主页上单击的链接。

这样:

<a href="link.html" onclick="set this link to memory" target=home></a>
<a href="a memory of that other link" target=home></a>

想法是,iframe 中的页面可以有链接,用户可以在停留在主页上的同时跟随这些链接,并且能够从主页上的中央链接返回到插入该框架的原始页面。

感谢大家的帮助。我对此进行了相当多的研究,并尝试使用 javascript 和 jquery,但我太新手了,无法使任何工作正常进行。

最佳答案

只试试这个:

<a href="javascript:;" onclick="window.memLink = ['link.html', this];" target=home>Copier Link!</a>

<a href="javascript:;" onclick="this.href=window.memLink[0]; this.onclick();" target=home>Dynamic Link!!</a>

Try this Online!!

关于javascript - 将链接设置为等于上次单击的链接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51412623/

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