想在woocommerce页面上使用mailto:function

时间:2017-07-17 07:26:06

标签: javascript html woocommerce mailto

想在woocommerce页面上使用mailto:function,当有人点击图片时..应该在邮件正文中打开包含预先写好的电子邮件和主题及当前页面网址的撰写页面

这是我的代码

add_action( 'woocommerce_single_product_summary', 'enfold_customization_extra_product_content', 25 );

function enfold_customization_extra_product_content() {
echo '<a href="mailto:someone@someone.com?subject=please check the link in the below email message body&body=[sub]" onclick="this.href =this.href.replace('[sub]',window.location)"><img src="http://sareechoice.com/wp-content/uploads/2017/07/mailimage.jpeg" alt="Go to W3Schools!" width="299" height="299" border="0"></a>';
}

我在woocommerce页面中使用此代码,但遗憾的是网站发出致命错误并崩溃....但如果相同的代码我插入html的body标签内的正常html页面..然后它作为用户工作能够点击链接,打开包含预定义电子邮件,主题和正文以及当前页面网址的撰写页面。

提前致谢

0 个答案:

没有答案