How do I create an email link using javascript attached to an image link?

The simpler methods I have so far been able to find only work within form elements.

I have also tried...

window.location="mailto:contact@mydomain.com"

parent.location="mailto:contact@mydomain.com"

location.href="mailto:contact@mydomain.com"


... none of which seem to work.

What's the secret? Where am I going wrong?