Home > Web Front-end > JS Tutorial > body text

Detailed example of how to simply implement the click-to-jump login email function using JS

小云云
Release: 2018-01-02 09:11:08
Original
2173 people have browsed it

This article mainly introduces the method of JS to simply implement the click-to-jump login mailbox function, involving JS implementation techniques related to hash table traversal and dynamic operation of page element attributes. Friends who need it can refer to it. I hope it can help everyone

Preface

During the registration process, you often need to fill in your email address and log in to your email address for verification. JS can be used to implement click login verification for different email addresses. The following is the implementation plan, which is very simple

Code

Email domain name data


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.com': 'http://www.foxmail.com',
  'outlook.com': 'http://www.outlook.com'
}
Copy after login

Get the email domain and replace the link (jQuery needs to be introduced here)

// 点击登录邮箱
var _mail = $("#email").val().split('@')[1];  //获取邮箱域
for (var j in hash){
  if(j == _mail){
    $(".js_login_mail").show().attr("href", hash[_mail]);  //替换登陆链接
  }
}
Copy after login

Related recommendations:

Mui uses jquery and Sharing examples of using click to jump to a new window

Using ionic to achieve infinite carousel and click to jump

Mui uses jquery and uses click to jump New window example sharing

The above is the detailed content of Detailed example of how to simply implement the click-to-jump login email function using JS. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!