样式编码的mailto地址

时间:2014-10-24 10:17:19

标签: javascript css mailto

我使用在线电子邮件编码器来生成一种收集器的电子邮件链接,但此链接无法适应我的样式。有谁知道我如何设计这种链接?截至目前,我不知道在哪里调用css类。

以下是我编码的链接示例:

<div class="mailto-link"><script type="text/javascript"><!--
var gefmyis = ['m','r','l','l','i','a','m','m',' ','e','o','a','"','h','m','e','<','e','/','o',':','a',
'>','a','s','t','c','m','s','l','"','=','.','i','t','>',
'l','f','i','@','.','s','s','"','<','e','"','o','a','c',
't','l','m','t','@',' ','c','=','e','e','i','t','a','a'];
var lmmezyh = 
[29,4,25,55,54,53,9,22,31,5,14,23,38,3,40,51,0,17,61,28,15,
34,45,62,36,13,27,52,18,43,8,37,26,24,49,63,33,6,11,20,56,35,
48,30,60,39,44,58,1,32,46,12,59,16,50,2,57,7,47,21,42,19,10,41];
var bsmqvte= new Array();for(var i=0;i<lmmezyh.length;i++)
{bsmqvte[lmmezyh[i]] = gefmyis[i]; }for(var i=0;i<bsmqvte.length;i++)
{document.write(bsmqvte[i]);}
// --></script>
<noscript>Please enable Javascript to see the email address</noscript></div>

谢谢!

1 个答案:

答案 0 :(得分:5)

修改

只需在控制台中检查该脚本实际创建的内容,您就会注意到这一点:

<a class="email" href="mailto:test@email.com">test@email.com</a>

表示CSS中的a.email就足够了

a.email{
    font-weight: bold;
    color:red;
}

http://jsfiddle.net/990exhow/


只需使用:

a[href^="mailto:"]{
    font-weight: bold;
    color:red;
}

http://jsfiddle.net/pbve1aum/1/

https://developer.mozilla.org/en-US/docs/Web/CSS/Attribute_selectors

或将所有内容包装成SPAN

<span class="mailtoStyle">
    <!-- all in here -->
</span>

并在你的CSS中:

.mailtoStyle a{
    font-weight: bold;
    color:red;
}

http://jsfiddle.net/pbve1aum/2/