Function getEmail (email)
{
Var r = "";
For (I = 0; I <email. length; I ++)
{
R + = "& #" + email. charCodeAt (I );
}
Return r;
}
The effect is as follows:
<! 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 "> </style> </pead> <body> <p> <strong> Email address encryption </strong> </p> <p> Email: <input name = "email" type = "text" id = "email" size = "50"/> <input type = "button" name = "Submit" value = "add password "onclick =" document. getElementById ('export '). value = getEmail (document. getElementById ('email '). value) "/> <input type =" button "name =" Submit2 "value =" Verification "onclick =" document. getElementById ('preview '). innerHTML = getEmail (document. getElementById ('email '). value) "/> </p> <p> result: <input name = "export" type = "text" id = "export" size = "76" onclick = "setClipboard (this. id) "onmouseover =" javascript: this. select (); "title =" Click here to copy content "/> </p> </body> </ptml>
[Ctrl + A select all Note: If you need to introduce external Js, You need to refresh it to execute]