JavaScript - href标签不会将文本转换为链接 [英] JavaScript - href tags not turning text into link

查看:90
本文介绍了JavaScript - href标签不会将文本转换为链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好!



我的html href标签有问题。我正在构建一个字符串作为打开电子邮件的链接,该电子邮件应该包含mailto部分正文部分中的链接。



这就是我所拥有的远:



 conf_html + =  < a href ='mailto:?subject =免费订阅智能零售商杂志& body =我刚刚免费订阅了Smart Retailer杂志。你也可以通过%3Ca href =%22; 
conf_html + = newQS;
conf_html + = %22%3点击此处%3C%2Fa%3E;





这是电子邮件窗口启动时的输出结果。



我刚订阅了Smart Retailer杂志免费版。您也可以通过点击此处



这是电子邮件的文本。我应该看到点击这里作为链接。 newQS不是完整的http链接,而是点击后将添加到地址主要部分的部分。谁能告诉我我做错了什么?



谢谢大家!

解决方案

我想如果你可以匹配你的脚本然后它会工作:





< a href =   mailto:test@test.test?body =链接%20goes%20here%20http%3A%2F%2Fwww.example.com %2Ffoo.php%3此%3Da%26join%3Dabc%26user454>链接文本在此处< /   a  >  





谢谢!


Hi everyone!

I have an issue with html href tags. I'm building a string to be a link to open email that is supposed to include a link in the body section of the mailto section.

Here's what I have so far:

conf_html += "<a href='mailto:?subject=Free Subscription to Smart Retailer Magazine&body=I just subscribed to Smart Retailer magazine for free. You can too by %3Ca href=%22";
conf_html += newQS;
conf_html += "%22%3Eclicking here%3C%2Fa%3E";



Here's what the output looks like when the email window is launched.

I just subscribed to Smart Retailer magazine for free. You can too by clicking here.

This is the text of the email. I should be seeing "clicking here" as a link. "newQS" is not a full http link, but the portion that will be tacked onto the main part of the address once it is clicked. Can anyone tell me what I'm doing wrong?

Thanks everyone!

解决方案

I think if you can match with you script then it will work:


<a href="mailto:test@test.test?body=Link%20goes%20here%20http%3A%2F%2Fwww.example.com%2Ffoo.php%3Fthis%3Da%26join%3Dabc%26user454 ">Link text goes here</a>



thanks!


这篇关于JavaScript - href标签不会将文本转换为链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆