JavaScript输入邮箱后,跳转邮箱地址,链接绑定

a 标签点击后,跳转到邮箱的相应地址,这里面列出了基本所有网上邮箱的地址,这样就可以根据输入的邮箱格式来确定跳转到哪个邮箱的地址

//邮箱发送地址
function mailSend(obj){                                  
    window.location = ""+alertEmail.getEmailHttp($("#email").val());
}
var alertEmail = {
    getEmailHttp : function(email) {
        var emailType = email.substring(email.indexOf('@') + 1), emailUrl = '', html = '';
        emailType = emailType.toLowerCase();
        switch (emailType) {
        case 'qq.com':
        case 'vip.qq.com':
        case 'foxmail.com':
            emailUrl = 'http://mail.qq.com/';
            break;
        case '163.com':
        case '126.com':
        case 'yeah.net':
        case 'vip.163.com':
        case '188.com':
            emailUrl = 'http://email.163.com/';
            break;
        case 'tom.com':
            emailUrl = 'http://mail.tom.com/';
            break;
        case 'sina.com':
        case 'vip.sina.com':
        case 'sina.com.cn':
            emailUrl = 'http://mail.sina.com.cn/';
            break;
        case 'sohu.com':
        case 'souhu.com':
        case 'vip.sohu.com':
            emailUrl = 'http://mail.sohu.com/';
            break;
        case '139.com':
        case '136.com':
            emailUrl = 'http://mail.10086.cn/';
            break;
        case 'gmail.com':
            emailUrl = 'http://www.gmail.com/';
            break;
        case 'hotmail.com':
        case 'msn.com':
        case 'live.cn':
        case 'live.com':
        case 'msn.cn':
        case 'hotmail.com.cn':
            emailUrl = 'https://login.live.com/';
            break;
        case 'yahoo.com.cn':
        case 'yahoo.cn':
        case 'yahoo.com':
            emailUrl = 'http://mail.cn.yahoo.com/';
            break;
        case '21cn.com':
        case '21cn.net':
            emailUrl = 'http://mail.21cn.com/';
            break;
        case 'sogou.com':
            emailUrl = 'http://mail.sogou.com/';
            break;
        case '189.cn':
            emailUrl = 'http://www.189.cn/';
            break;
        case 'yjcp.com':
            emailUrl = 'http://www.yjcp.cn/';
            break;
        case 'eyou.com':
            emailUrl = 'http://www.eyou.com/';
            break;
        default:
            emailUrl = 'http://www.' + emailType + '/';
        }
        return emailUrl;
    }
};



你可能感兴趣的:(JavaScript,邮箱)