The introduction of jquery is a must 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;" > Mailbox User: <input type= "text" style= "width:120px" id= "Mailusername"/> Password: <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= "Login"/> </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 (); Empty Mailbox List 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 (' Please enter your mailbox login name! '); return false; }else if ($mailPassword. val () = = ") { Alert (' Please enter your login password! '); 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 (' Doc.write (' <p align= "center" style= font-size:14px; color: #FF0000 "> is logging on to the system, please wait ... </p><form name=" Tmpform "action=" ' +$ (' #mailForm '). attr (' action ') + ' method= ' post ' > ' +$ (' #mailParas '). html () + ' </form>< /body>Doc.close (); return false; } }, Find:function (MAIL,MD) {//Find by mail name for (Var i=0;i<md.length;i++) { if (Md[i].mail = = mail) return md[i]; } } } $ (function () { Mail.init (); }) |