Add hyperlink or trigger onClick event in email body - Javascript DOM Event

Javascript examples for DOM Event:onclick

Description

Add hyperlink or trigger onClick event in email body

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript">
function mailTo(mailAddr){/*from w  w  w. j  a va2  s. c  o  m*/
       var aTag = document.createElement("a");
       aTag.href = "mailto:" + mailAddr;
       aTag.id = "openMailClient";
       aTag.target = "_blank";
       aTag.innerHTML = " ";
       aTag.click();
 }

      </script> 
   </head> 
   <body> 
      <button onclick="mailTo('abc@example.com')">Test</button>  
   </body>
</html>

Related Tutorials