Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <title>JavaScript Email-Mask</title>
- <style type="text/css" media="screen">
- #Wrapper
- {
- width: 971px;
- margin: 0 auto;
- font-family: Verdana;
- }
- </style>
- </head>
- <body>
- <div id="Wrapper">
- <%
- strCopyDisable = "<span style=""font-size: 0;\"">(fjern paranteser og indhold)</span>"
- Randomize()
- For i = 0 To UBound(arrEmails)
- DisplayMaskedEmail(arrEmails(i))
- Next
- %>
- </div>
- <script type="text/javascript">
- function unmaskEmail(email, intShift)
- {
- var strUnmaskedEmail = "";
- for (var i = 0; i < email.length; i++)
- {
- strUnmaskedEmail += String.fromCharCode(email.charCodeAt(i) + (intShift * (-1)));
- }
- window.open(strUnmaskedEmail, "_self");
- }
- </script>
- </body>
- </html>
- <%
- Function MaskEmail(strEmail, intShift)
- strMaskedEmail = ""
- For j = 1 To Len(strEmail)
- strMaskedEmail = strMaskedEmail + Chr(Asc(Mid(strEmail, j, 1)) + intShift)
- Next
- MaskEmail = strMaskedEmail
- End Function
- Function DisplayMaskedEmail(strEmail)
- strCopyDisable = "<span style=""font-size: 0;\"">(fjern paranteser og indhold)</span>"
- Randomize()
- intShift = Int(1 + Rnd(4) * 4)
- strMaskedLink = MaskEmail("mailto:" & strEmail, intShift)
- strEmail = Replace(strEmail, "@", strCopyDisable & "@" & strCopyDisable)
- Response.Write("<a href=""javascript:void(0);"" onclick=""unmaskEmail('" & strMaskedLink & "', " & intShift & ");"">" & strEmail & "</a><br />")
- End Function
- %>
Advertisement
Add Comment
Please, Sign In to add comment