using mailto in a button click event

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Not being an web programmer I am unable to figure out how to put the
hyperlink mailto:emailaddress in a button click event. I do not want a
hyperlink on the form. I have found nothing to address this. using
response.redirect is not the answer because you do not return to the page
with the button on it.
Also, is it necessary to encode the address and if yes, how to do that, please

Thanks. I am sure this is very simple but I am a windows programmer not used
to links, html, etc.
 
That's client-side stuff.
Add an onclick handler to a simple html button, not
a server control, like so: onclick="return OpenMail();"

Then in the javascript on the page, in
client-side script tags, best in the html header:

<script type="text/javascript">
function OpenMail()
{
location.href = "mailto:[email protected]";
return false;
}
</script>

That should do it.
No encoding should be necessary.
 
I have used your suggestion which seems clearly the right way, but I have
this error:
handles clause requires withevents qualifier.

where would this go? on the function heading. Or is there a withevents
needed and where would that go?
 
I had spoken to soon. The problem was that I failed to remove the button
click event for the asp button that I removed when I instead used the html
button. Moral of story: the error message may be accurate but difficult to
decipher--
smHaig
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top