程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> 更多編程語言 >> 更多關於編程 >> 如何對Email地址進行加密?

如何對Email地址進行加密?

編輯:更多關於編程

     email地址加密代碼:

    <code><meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″ /></code>

    <style type=”text/css”><!–
    body {     font-size: 12px; }
    –></style><script type=”text/javascript” language=”javascript”>// <![CDATA[
    var email = "[email protected]";
    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.setData("Text", copytext);
    alert("已復制到剪貼板。");
    }
    else if (window.netscape)
    {
    setClipboardNetscape(copytext);
    alert("已復制到剪貼板。");
    }
    }
    return false;
    }

    function setClipboardNetscape(text){
    var url = [
    'data:text/html;charset=utf-8;base64,PGJvZHk+PC9ib2',
    'R5PjxzY3JpcHQgdHlwZT0idGV4dC9qYXZhc2NyaXB0Ij4KKGZ1',
    'bmN0aW9uKGVuY29kZWQpe3ZhciBzd2ZfZGF0YSA9IFsKICdkYX',
    'RhOmFwcGxpY2F0aW9uL3gtc2hvY2t3YXZlLWZsYXNoO2Jhc2U2',
    'NCxRMWRUQjJ3JywKICdBQUFCNG5EUGdZbGpBd01qSTRNejAlMk',
    'YlMkY5JTJGZTJaZkJnYUdhV3dNRE1uNUthJywKICdrTU10TjRH',
    'ZGdaZ1NJTXdaWEZKYW01UUFFJTJCQm9iaTFCTG5uTXlDcFB6RW',
    '9oU0dJJywKICdQRnAlMkZBeHNEREJRa3BGWkRGUUZGQ2d1eVM4',
    'QXlqSTRBRVVCaXkwVndBJTNEJTNEJwpdLmpvaW4oIiIpOwpkb2',
    'N1bWVudC5ib2R5LmlubmVySFRNTCA9IFsKICc8ZW1iZWQgc3Jj',
    'PSInLHN3Zl9kYXRhLCciICcsCiAnRmxhc2hWYXJzPSJjb2RlPS',
    'csZW5jb2RlZCwnIj4nLAogJzwvZW1iZWQ+JwpdLmpvaW4oIiIp',
    'Owp9KSgi',
    base64encode( encodeURIComponent(text) + '")</'+'script>')
    ].join(“”);
    var tmp = document.createElement(“div”);
    tmp.innerHTML = [
    '<iframe src="',url,'"'             ,' width="0" height="0">'
    ,'</iframe>'
    ].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+/”.split(“”);
    var c1, c2, c3;
    var buf = [];
    var len = str.length;
    var i = 0;
    while(i < len){                 c1 = str.charCodeAt(i) &#038; 0xff;                 c2 = str.charCodeAt(i+1);                 c3 = str.charCodeAt(i+2);                 buf.push(Chars[(c1 >> 2)]);
    if(i+1 == len){
    buf.push(Chars[(c1 &#038; 0x3) << 4],”==”);
    break;
    }
    buf.push(Chars[((c1 &#038; 0x3) << 4) | ((c2 &#038; 0xF0) >> 4)]);
    if(i+2 == len){
    buf.push(Chars[(c2 &#038; 0xF) << 2],”=”);
    break;
    }
    buf.push(
    Chars[((c2 &#038; 0xF) << 2) | ((c3 &#038; 0xC0) >> 6)],
    Chars[(c3 &#038; 0x3F)]
    );
    i+=3;
    }
    return buf.join(“”)
    }
    }
    // ]]></script>

    &nbsp;

    <strong>Email地址加密</strong>

    Email:
    <input id=”email” type=”hidden” name=”email” size=”50″ value=”[email protected]” />
    <input onclick=”document.getElementById(‘export’).value=getEmail(document.getElementById(‘email’).value)” type=”button” name=”Submit” value=” 加 密 ” />

    <input onclick=”document.getElementById(‘preview’).innerHTML=getEmail(document.getElementById(‘email’).value)” type=”button” name=”Submit2″ value=” 點擊查看Email ” />  <span id=”preview” style=”color: #ff0000;”> </span>

    結 果:
    <input id=”export” type=”text” name=”export” size=”76″ />

    &nbsp;

    1. 上一頁:
    2. 下一頁:
    Copyright © 程式師世界 All Rights Reserved