DIV CSS 佈局教程網

 DIV+CSS佈局教程網 >> 網頁腳本 >> JavaScript入門知識 >> jQuery入門知識 >> JQuery特效代碼 >> 根據郵箱的域名跳轉到相應的登錄頁面的代碼
根據郵箱的域名跳轉到相應的登錄頁面的代碼
編輯:JQuery特效代碼     
. 代碼如下:
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>js郵箱地址跳轉</title>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
var hash={
'qq.com': 'http://mail.qq.com',
'gmail.com': 'http://mail.google.com',
'sina.com': 'http://mail.sina.com.cn',
'163.com': 'http://mail.163.com',
'126.com': 'http://mail.126.com',
'yeah.net': 'http://www.yeah.net/',
'sohu.com': 'http://mail.sohu.com/',
'tom.com': 'http://mail.tom.com/',
'sogou.com': 'http://mail.sogou.com/',
'139.com': 'http://mail.10086.cn/',
'hotmail.com': 'http://www.hotmail.com',
'live.com': 'http://login.live.com/',
'live.cn': 'http://login.live.cn/',
'live.com.cn': 'http://login.live.com.cn',
'189.com': 'http://webmail16.189.cn/webmail/',
'yahoo.com.cn': 'http://mail.cn.yahoo.com/',
'yahoo.cn': 'http://mail.cn.yahoo.com/',
'eyou.com': 'http://www.eyou.com/',
'21cn.com': 'http://mail.21cn.com/',
'188.com': 'http://www.188.com/',
'foxmail.coom': 'http://www.foxmail.com'
};

$(function(){
$(".mail").each(function() {
var url = $(this).text().split('@')[1];
for (var j in hash){
$(this).attr("href", hash[url]);
}
});
})
</script>
</head>

<body>
<a href="#" target="_blank" class="mail">[email protected]</a> <br>
<a href="#" target="_blank" class="mail">[email protected]</a> <br>
<a href="#" target="_blank" class="mail">[email protected]</a> <br>
<a href="#" target="_blank" class="mail">[email protected]</a> <br>
<a href="#" target="_blank" class="mail">[email protected]</a> <br>
<a href="#" target="_blank" class="mail">[email protected]</a>
</body>
</html>
XML學習教程| jQuery入門知識| AJAX入門| Dreamweaver教程| Fireworks入門知識| SEO技巧| SEO優化集錦|
Copyright © DIV+CSS佈局教程網 All Rights Reserved