Javascript “如何放置”;window.location.href";在HTML链接中
我的剧本:Javascript “如何放置”;window.location.href";在HTML链接中,javascript,php,Javascript,Php,我的剧本: <script language="javascript"> function emailCurrentPage() { window.location.href = "mailto:?subject=" + document.title + "&body="+ encodeURI(document.location); } </sc
<script language="javascript">
function emailCurrentPage() {
window.location.href = "mailto:?subject=" + document.title + "&body="+ encodeURI(document.location);
}
</script>
<button onclick="emailCurrentPage()">Email page</button>
想做为HREF链接吗
<a href="example.com/?Price=250&Color=Red/" target="_top">Your Order</a>
帮助?您可以动态创建
元素,例如:
const linkElement=document.createElement(“a”);
linkElement.href=“yourURL”//你自己的逻辑
linkElement.target=“_top”;
linkElement.text=“您的订单”
document.body.append(linkElement);
您可以尝试以下方法:
<button onclick="window.location.href='example.com/?Price=250&Color=Red/'">Email page</button>
电子邮件页面
您需要更好地描述它,目前,它只是。。。不清楚。您似乎描述的是一个普通的mailto链接所做的事情:
-也就是说,您不需要javascript按钮来完成这项工作。您可以将..
设置为按钮的样式,和/或将..
放在
需要是动态url的周围
<button onclick="window.location.href='example.com/?Price=250&Color=Red/'">Email page</button>