Click to See Complete Forum and Search --> : help with javascript library


bpayne111
02-28-2004, 11:04 PM
i'm trying to create a javascript function that will hide my email address from spyders.

i've added the following function to my library

function SecureMailTo(user,domain,ext)
{
var first = 'ma';
var second = 'il';
var third = 'to:';

document.write('<a href="');
document.write(first+second+third);
document.write(user);
document.write('@');
document.write(domain);
document.write('.');
document.write(ext);
document.write('">');
document.write('Email Me</a>');

}

my javascript debugger says there are no syntax errors on the page...
but i'm having trouble implementing this library into my web document

here is my code for my document

<?xml version="1.0" encoding="UTF-8"?>
<!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">
<!-- Copyright: BnPayne
Date: 2/1/04
-->
<head>
<script type="text/javascript" language="javascript" src="ChessLibrary.js">
</script>

</head>

<body>
<br />
<script type="text/javascript" language="javascript">
<!--

SecureMailTo("bp","mydomain","com");

//-->
</script>
script above

</body>
</html>


any help in figuring out what i'm doing wrong would be appreciated

thanks
brandon

Malone
03-01-2004, 09:32 AM
Well what is the output of the script? (What does the page look like?)

bpayne111
03-01-2004, 09:02 PM
i figured it out i was using the wrong comment tag... (html instead of js) whoops

thanks anyway