Running javascript in a JScript function?

I want to launch a javascript alert in all mailto links
in a website.  I'd like to create a JScript function that
I can include in my asp pages that takes an email address
and creates the mailto link and the javascript alert.  But I'm
little vague on how to go about this.

My script:
<% function EmailAlert(whoto){ %>

<a href="mailto:<%= whoto %>" name="theLink" onClick="return MailtoAlert(this)"><%= whoto %></a>

<SCRIPT LANG="JavaScript">
function doAlert(theLink)
      var sMessage = ''
      sMessage += 'Internet e-mail is uncertain.  By sending confidential or sensitive e-mail '
      sMessage += 'messages which are not encrypted you accept the risks of such uncertainty. '
                  
      var TF = confirm( sMessage );
    if ( !TF ) {
        alert ('Returning you to the previous page.')
          window.history.go(-1)
            }
}
</SCRIPT>
<%
}
EmailAlert("denam@fsr.com")
%>

This function is being included in a test asp page.  The browser
tells me there's an error on line 6, but I'm doubtful that
line 6 is the real problem.  Any suggestions?

thanks a bunch,
Dena
LVL 1
denamAsked:
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.

helverCommented:
Does the fact that you're referencing the MailtoAlert function in your click handler and you've written a doAlert function have anything to do with the problem you're having?
0
denamAuthor Commented:
Hi Helver, it did, and a couple of other things.  
This is what I got working.

<% function EmailAlert(whoto){ %>

<a href="mailto:<%= whoto %>" onClick="return doAlert()">
<%= whoto %></a>

<SCRIPT LANGUAGE = "JavaScript">
function doAlert(){

var sMessage = ''
sMessage += 'Internet e-mail is uncertain.  By sending confidential or sensitive e-mail '
sMessage += 'messages which are not encrypted you accept the risks of such uncertainty. '

var TF = confirm( sMessage );
    if ( !TF ) {
    return false
    } else
    return true
}
</SCRIPT>
<%
}
%>

I don't mind giving you the points if you submit a question.

Dena
0
helverCommented:
If you feel like what I did suggested was worth 200 pts, then I'll happily take them... otherwise, it wouldn't hurt my feelings if you wanted to save those points for a more difficult question...
0

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
denamAuthor Commented:
Somehow, I ended up with a whole bunch of points.
It might be bad karma to be stingy with them.

cheers,
Dena
0
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
Web Development

From novice to tech pro — start learning today.