Return to Snippet

Revision: 10611
at January 5, 2009 19:47 by iloveitaly


Initial Code
function createJSMailLink($email) {
	$numArray = array();
	
	for($a = 0; $a < strlen($email); $a++) {
		$numArray[] = ord($email{$a});
	}
	
	$asciiString = implode(",", $numArray);
	
	return <<<EOL
<script type="text/javascript" charset="utf-8">
	var _ed = "";
	var _en = new Array({$asciiString});
	
	for(var a = 0; a < _en.length; a++) {
		_ed += String.fromCharCode(_en[a]);
	}
	
	document.write("<a href=\"" + "mailto:" + _ed + "\">" + _ed + "</a>");
</script>
EOL;
}

Initial URL

                                

Initial Description

                                

Initial Title
Secure e-mail Link

Initial Tags
email, javascript, php, link

Initial Language
PHP