JavaScript equivalent of href=""

<tr height="20">
                  <td height="20" width="145"><font size="2" face="Arial">Email Address</font></td>
                  <td height="20" width="156"><a href=""><font size="2" face="Arial">
                          <script type="text/javascript"> generateEmail("Email", "Address")</script> </font></a></td>

I have created a generate email function using javaScript to replace the email address in the content of the anchor tag (see above). Unfortunately, the plain text email address still resides in the href attribute. Id like to remove this using javaScript as well, any suggestions?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Saqib KhanSenior DeveloperCommented:

                  <td height="20" width="145"><font size="2" face="Arial">Email Address</font></td>
                  <td height="20" width="156"><a href="javascript:generateEmail('Email', 'Address')"><font size="2" face="Arial">
                          <script type="text/javascript"> generateEmail("Email", "Address")</script> </font></a></td>

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Jason C. LevineDon't talk to me.Commented:
Hi jdana,

There is a great extension for Dreamweaver that will help immensely.  Download Super Email if you get a chance:

Sample output is below:

<script language="JavaScript" type="text/javascript">
<!-- Begin
document.write('<a href=\"mailto:test'+ '@' + '\">');
document.write('Hi jdana</a>');
// End -->
Use :

location.href = "";

Example with captcha :

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script language="javascript">
	function sendEmail() {
		var f = document.forms[0];
		if( (f.lname.value!="") && (f.fname.value!="") && (/^[a-z0-9._-]+@[a-z0-9.-]{2,}[.][a-z]{2,3}$/.exec(!=null) && (!="") && (f.comments.value!="") ) {
			if(document.forms[0].answer.value.toLowerCase() == images[i][document.forms[0].captcha.src].toLowerCase()) {
				var yourEmail = "";
				var subject = "&subject=YOUR SUBJECT HERE : " + f.fname.value + " " + f.lname.value + "( email: " + + " ) / ( phone: " + + " )";
				var comments = escape(f.comments.value);
				location.href = yourEmail + subject + "&body="+ comments;
			else {
				alert("brand not correct");
		else {
			alert("please complete the form with and check your email!");
	var images = [{"":"Apple"}, {"":"Microsoft"}, {"":"IBM"}];
	var i = null;
	function captcha() {
		i = Math.floor( Math.random() * 3);
		for(url in images[i]) document.forms[0].captcha.src = url;

<body onload="captcha();">
    First Name :&nbsp;<input type="text" name="fname"  /><br />
    Last Name :&nbsp;<input type="text" name="lname" /><br />
    Email Address :&nbsp;<input type="text" name="email" /><br />
    Phone Number :&nbsp;<input type="text" name="phone" /><br />
    Question/Comment :&nbsp;<textarea name="comments" cols="48" rows="6"></textarea><br />
    What's name of this brand :&nbsp;<img src="" name="captcha" width="96" />&nbsp; It's :&nbsp;<input type="text" name="answer" />
    <br />
    <input type="button" value="send email" onclick="sendEmail();" />

Open in new window

jdanaAuthor Commented:
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.