javascript - 使用 html 和 javascript 将 href 值传递到另一个页面

标签 javascript jquery html

enter image description here

如上所述,我需要创建一个将在 anchor 标记中使用的 class="donate" ,它将重定向并将 href 的值传递给我的另一个页面即 -mysite.com/donate.html,

donate.html 将能够获取该 href 值。 这样当用户点击“继续下载”时就可以下载 文件。

请告诉我是否可以。 我更喜欢仅 HTML 和 javascript。因为我不托管网页,所以我使用博客。

我在 templateism.com 上看到过类似的概念,例如:

www.templateism.com/p/preview.html?=www.templateism.com/10/2010/anypost.html

最佳答案

您可以使用以下链接:

mysite.com/donate.html?www.yoursite.com.otherpage.html

然后使用 JavaScript:

var href = document.location.href;
var link = href.split('?')[1];

关于javascript - 使用 html 和 javascript 将 href 值传递到另一个页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38244418/

相关文章:

javascript - 使用 ngResource、socket.io 和 $q 维护资源集合

javascript - 谷歌图表无法正常工作而不引发异常

php - 向 Wordpress header.php 添加多个 css

javascript - 当 tbody 不存在时追加到表以及如何使所有现有 jquery 适用于该行

jquery - 动画结束后如何删除类(class)?

html - 导航栏颜色不符合预期

html - 检查苹果触摸图标

javascript - setInterval() 数据库检查的替代方案 -> Meteor.js

javascript - 使用 jQuery 重新加载 ajax 内容

javascript - (this) 在 jQuery 中的用法