Pages

Subscribe:

Tuesday, March 27, 2012

Javascript


If you want to open mail client using javascript use the following code
<script type=”text/javascript”>
function mail() {
document.location.href = ‘mailto:demo@domain.com?subject=Subject &body=Hi,%0D%0A %0D%0AMail Body  %0D%0A %0D%0AThanks, %0D%0AName’;
}
</script>
To get the new line we have to use ‘%0D%0A’ in javascript.
<a href=”#” onclick=”mail()”>Email</a>

No comments:

Post a Comment