function Getemail (email)
{
var r = "";
for (i=0;i<email.length;i++)
{
R + + "&#" + email.charcodeat (i);
}
return R;
}
The effect is as follows:
<!--Author:yao.cnblogs.com datetime:2006-08-24--> <! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd "> <ptml xmlns=" http://www.w3.org/1999/xhtml "> <pead> <meta http-equiv=" Content-type "content=" text/html; charset=gb2312 "/> <title>email address encryption </title> <style type=" Text/css "> <!--body {font-size : 12px; }--> </style> <script language= "javascript" type= "Text/javascript" > function getemail (email) {var r = ""; for (i=0;i<email.length;i++) {r = = "&#" + email.charcodeat (i); } return R; function SetClipboard (ID) {var TB = document.getElementById (ID); var copytext = Tb.value; if (copytext!= "") {if (window.clipboarddata) {WINDOW.CLIPBOARDDATA.S Etdata ("Text", copYtext); Alert ("has been copied to the Clipboard.) "); else if (window.netscape) {setclipboardnetscape (copytext); Alert ("has been copied to the Clipboard.) "); return false; function Setclipboardnetscape (text) {var url = [' Data:text/html;charset=utf-8;base64,p Gjvzhk+pc9ib2 ', ' r5pjxzy3jpchqgdhlwzt0idgv4dc9qyxzhc2nyaxb0ij4kkgz1 ', ' BMN0AW9UKGVUY29KZWQPE3ZHC Ibzd2zfzgf0ysa9ifskicdkyx ', ' rhomfwcgxpy2f0aw9ul3gtc2hvy2t3yxzllwzsyxnoo2jhc2u2 ', ' NCxRMWRUQjJ3J Ywkicdbqufcng5eugdzbgpbd01qstrnejalmk ', ' ylmky5jtjgztjazkjnyudhv3dnre1unuthjywkicdrtu10tjrh ', ' Z Gdaz1njtxdawezkyw01uuffjtjcqm9iatfctg5utxldcfb6rw ', ' 9ou0djjywkicdqrnalmkzbehnerejra3bgwkrguuzgq2d1evm4 ', ' Qxlqstrbrvvcaxkwvndbjtnejtnejwpdlmpvaw4oiiipowpkb2 ', ' N1BWVUDC5IB2R5LMLUBMVYSFRNTCA9IFSKICC8ZW1IZW Qgc3jj ', ' Psinlhn3zl9kyxrhlcciiccscianrmxhc2hwyxjzpsjjb2rlps ', ' Cszw5jb2rlzcwnij4nlaogjzwvzw1izwq+jwpdlmpvaw4oii Ip ', ' Owp9ksgi ', Base64Encode (encodeuricomponent (text) + ' ") </' + ' script> ')].joi N (""); var tmp = document.createelement ("div"); tmp.innerhtml = [' <iframe src= ', url, ' ' ', ' width= ' 0 ' height= ' 0 ' > ', ' </i Frame> '].join (""); With (Tmp.style) {position = "absolute"; left = " -10px"; top = " -10px"; visibility = "hidden"; }; Document.body.appendChild (TMP); settimeout (function () {document.body.removeChild (TMP)},1000); function Base64Encode (str) {var Chars = "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz0123456789+/". SP Lit (""); var C1, C2, C3; var buf = []; var len = str.length; var i = 0; while (I < len) {c1 = Str.charcodeat (i) & 0xFF; C2 = Str.charcodeat (i+1); C3 = Str.charcodeat (i+2); Buf.push (chars[(C1 >> 2)]); if (i+1 = len) {Buf.push (chars[(C1 & 0x3) << 4], "= ="); Break } Buf.push (chars[(C1 & 0x3) << 4) | ((C2 & 0xF0) >> 4)]); if (i+2 = len) {Buf.push (chars[(C2 & 0xF) << 2], "="); Break } buf.push (chars[(C2 & 0xF) << 2) | ((C3 & 0xc0) >> 6)], chars[(C3 & 0x3F)]); i+=3; Return Buf.join ("")}} </script> </pead> <body> <p><stro Ng>email Address Encryption </strong></p> <p> Email: <input name= "Email" type= "text" id= "size="/> <input "button" type= "Submit" name= E= "Encrypt" onclick= "document.getElementById" (' Export '). Value=getemail (document.getElementById (' email '). Value) "/> <input type= "button" Name= "Submit2" value= "verify" onclick= "document.getElementById (' Preview '). Innerhtml=getemail (document.getElementById (' email '). Value) "/> <span id=" Preview "> </span > </p> <p> results: <input name= "Export" type= "text" id= "Export" size= "" onclick= "SetC" Lipboard (this.id) "onmouseover=" Javascript:this.select (); "Title=" click here to copy Content "/> </p> <p> </p> & Lt;/body> </ptml>
[Ctrl + A All SELECT Note: If the need to introduce external JS need to refresh to perform]