您的位置:首页 > Web前端 > JQuery

jQuery中 获取页面的所有电子邮箱

2017-05-03 16:40 211 查看
<html>
<head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
<script type="text/javascript">
$(function(){
var emails = $("a[href^='mailto:']");
var idx;
var len = emails.length;
var str = "Found the following `mailto` links:<ul>";
for (idx = 0; idx < len; idx++) {
str += "<li>" + emails[idx] + "</li>";
}
str += "</ul>"
$('p#debug').html(str);
});
</script>
</head>
<body>

<a href="http://cfexamples.com/">Go to ColdFusionExamples.com</a>
<a href="mailto:jane@doe.com">email Jane Doe</a>
<a href="mailto:user@domain.org">email User</a>
<p>The quick brown fox jumps over the lazy dog</p>
<hr/>
<p id="debug"></p>
</body>
</html>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: