仿hao123郵箱登入效果

來源:互聯網
上載者:User
 代碼如下 複製代碼

引入jQuery 是必須的

html:

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"  type="text/javascript"></script>
  <script src="mail.min.js" type="text/javascript"></script>
<form id="mailForm"  method=post>
    <span style="float:left" id="date_now"></span>
    <span style="padding-left:20px;">
 信箱使用者:<input type="text" style="width:120px;" id="mailUserName"  />
 密碼:<input style="width:100px;" id="mailPassword" type="password" />
    <select name="mailSelect" class="h" id="mailSelect" style="BORDER-RIGHT: #ffffff 0px groove; BORDER-TOP: #ffffff 0px groove; FONT-SIZE: 12px; BORDER-LEFT: #ffffff 0px groove; BORDER-BOTTOM: #333333 1px groove; HEIGHT: 18px; BACKGROUND-COLOR: #ffffff">
   
 <select>
 <span id="mailParas" style="display:none;"></span>
      <input id="btnMailLogin" type="submit" value="登入"/>
    </span>
  </form>

  

javascript:

var mail = {
 mailData:[
  {
   mail: "163",
   name: "@163.com",
   action: "http://reg.163.com/CheckUser.jsp",
   params: {
    url: "http://entry.mail.163.com/coremail/fcg/ntesdoor2?lightweight=1&verifycookie=1&language=-1&from=web&df=webmail163",
    username: "_username_",
    password: "_password_"
   }
  },
  {
   mail: "126",
   name: "@126.com",
   action: "https://reg.163.com/logins.jsp",
   params: {
    domain: "126.com",
    username: "_username_@126.com",
    password: "_password_",
    url: "http://entry.mail.126.com/cgi/ntesdoor?lightweight%3D1%26verifycookie%3D1%26language%3D0%26style%3D-1"
   }
  },
  {
   mail: "sina",
   name: "@sina.com",
   action: "http://mail.sina.com.cn/cgi-bin/login.cgi",
   params: {
    u: "_username_",
    psw: "_password_"
   }
  },
  {
   mail: "yahoocomcn",
   name: "@yahoo.com.cn",
   action: "https://edit.bjs.yahoo.com/config/login",
   params: {
    login: "_username_@yahoo.com.cn",
    passwd: "_password_",
    domainss: "yahoo",
    ".intl": "cn",
    ".src": "ym"
   }
  },
  {
   mail: "yahoocn",
   name: "@yahoo.cn",
   action: "https://edit.bjs.yahoo.com/config/login",
   params: {
    login: "_username_@yahoo.cn",
    passwd: "_password_",
    domainss: "yahoocn",
    ".intl": "cn",
    ".done": "http://mail.cn.yahoo.com/inset.html"
   }
  },
  {
   mail: "sohu",
   name: "@sohu.com",
   action: "http://passport.sohu.com/login.jsp",
   params: {
    loginid: "_username_@sohu.com",
    passwd: "_password_",
    fl: "1",
    vr: "1|1",
    appid: "1000",
    ru: "http://login.mail.sohu.com/servlet/LoginServlet",
    ct: "1173080990",
    sg: "5082635c77272088ae7241ccdf7cf062"
   }
  },
  {
   mail: "yeah",
   name: "@yeah.net",
   action: "https://reg.163.com/logins.jsp",
   params: {
    domain: "yeah.net",
    username: "_username_@yeah.net",
    password: "_password_",
    url: "http://entry.mail.yeah.net/cgi/ntesdoor?lightweight%3D1%26verifycookie%3D1%26style%3D-1"
   }
  },
  {
   mail: "139",
   name: "@139.com",
   action: "https://mail.10086.cn/Login/Login.ashx",
   params: {
    UserName: "_username_",
    Password: "_password_",
    clientid: "5015"
   }
  },
  {
   mail: "tom",
   name: "@tom.com",
   action: "http://login.mail.tom.com/cgi/login",
   params: {
    user: "_username_",
    pass: "_password_"
   }
  },
  {
   mail: "21cn",
   name: "@21cn.com",
   action: "http://passport.21cn.com/maillogin.jsp",
   params: {
    UserName: "_username_@21cn.com",
    passwd: "_password_",
    domainname: "21cn.com"
   }
  },
  {
   mail: "renren",
   name: "u4ebau4ebau7f51",
   action: "http://passport.renren.com/PLogin.do",
   params: {
    email: "_username_",
    password: "_password_",
    origURL: "http://www.renren.com/Home.do",
    domain: "renren.com"
   }
  },
  {
   mail: "baidu",
   name: "u767bu5f55u767eu5ea6",
   action: "https://passport.baidu.com/?login",
   params: {
    u: "http://passport.baidu.com/center",
    username: "_username_",
    password: "_password_"
   }
  },
  {
   mail: "51",
   name: "51.com",
   action: "http://passport.51.com/login.5p",
   params: {
    passport_51_user: "_username_",
    passport_51_password: "_password_",
    gourl: "http%3A%2F%2Fmy.51.com%2Fwebim%2Findex.php"
   }
  }],
 init:function(){
  var $mailSelect = $('#mailSelect');
  var $mailUserName =$('#mailUserName');
  var $mailPassword = $('#mailPassword');
  var $mailParas = $('#mailParas');
  var md = mail.mailData;
  var p=[];
  $mailSelect.empty(); //清空郵箱列表
  for(var i=0;i<md.length;i++){
   $mailSelect.append('<option value="'+md[i].mail+'">'+md[i].name+'</option>');
  }
  
  $mailSelect.change(function(){
   var mailName = $(this).val();
   var m = mail.find(mailName,md);
   if(m){
    p = [];
    for(var key in m.params){
     p.push('<input type="hidden" name="'+ key+'" value="'+m.params[key].replace(/_username_/,$mailUserName.val()).replace(/_password_/,$mailPassword.val())+'" />');
    };
    $mailParas.empty().html(p.join(''));
    
    $('#mailForm').attr('action',m.action);
   }
  }).change();
  
  $('#mailForm').bind('submit',function(){
   return mail.check();
  });
 },
 check:function(){
  var $mailSelect = $('#mailSelect');
  var $mailUserName =$('#mailUserName');
  var $mailPassword = $('#mailPassword');
  if($mailUserName.val()==''){
   alert('請輸入您的郵箱登入名稱稱!');
   return false;
  }else if($mailPassword.val()==''){
   alert('請輸入您的登入密碼!');
   return false;
  }else{
   $mailSelect.change();
   $mailPassword.val('');
   outWin=window.open('','','scrollbars=yes,menubar=yes,toolbar=yes,location=yes,status=yes,resizable=yes');  
   doc=outWin.document;  
   doc.open('text/html');  
   doc.write('<html><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312"><title>郵箱登入</title></head><body onload="document.tmpForm.submit()">');  
   doc.write('<p align="center" style="font-size: 14px; color: #FF0000">正在登入系統,請稍候......</p><form name="tmpForm" action="'+$('#mailForm').attr('action')+'" method="post">'+$('#mailParas').html()+'</form></body></html>');  
   doc.close();
   return false;
  }
 },
 find:function(mail,md){ //根據mail名稱尋找
  for(var i=0;i<md.length;i++){
   if(md[i].mail == mail)
    return md[i];
  }
 }
}

$(function(){
 mail.init();
})

 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.