Hey guys,
I am trying to make a script that lets people encrypt their email in their webpage. However I can seem to get it to work.
I’ve tried many many different combinations and positions of the code but it always comes up with trivial errors that should be easy to fix… but aren’t.
Heres the code that you can chuck in a browser to see what happens.
[code]
<html>
<head>
<title>Encrypt the email address on your page</title>
</head>
<body>
<script language=”javascript”>
//var d=”document”, w=”write”;
var encrypt, decrypt, email, et;
document.write(“<form name=”ef”>”);
document.write(“Email address: <input type=’text’ name=”txtemail”><br />”);
document.write(“Encryption: <input type=’text’ name=”txtet”><br />”);
document.write(“<button onclick=”execute();”>Encrypt</button>”);
function execute()
{
email=document[“ef”][“txtemail”].value;
et=document[“ef”][“txtet”].value;
document.write(“<input type=’hidden’ name=”encrypted” value=””);
for(i=0;i<email.length;i++)
{
document.write(String.fromCharCode(et^email.charCodeAt(i)));
}
document.write(“”>”);
encrypt=document[“ef”][“encrypted”].value;
document.write(“<input type=”hidden” name=”decrypted” value=””);
for(i=0;i<encrypt.length;i++)
{
document.write(String.fromCharCode(et^encrypt.charCodeAt(i)));
}
document.write(“”>”);
decrypt=document[“ef”][“decrypted”].value;
document.write(“Encrypted Form: <div style=’font-color: blue;’>”+encrypt);
document.write(“</div>”);
document.write(“Decrypted Form: <div style=’font-color: blue;’>”+decrypt);
document.write(“</div>”);
}
document.write(“</form>”);
</script>
</body>
</html>
Right now it gives me a [b]document.ef.encrypted is not an object[b]email is not defined
It is really confusing… help is much appreciated…
Cheers
hamstar