Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap

Q1702 How can I use an external JavaScript source file to amend all the mailto links in a document such that it appends a generic subject line?

You are here: irt.org | FAQ | JavaScript | Link | Q1702 [ previous next ]




<a href="mailto:martin@irt.org">mailto:</a>
<a href="http://www.irt.org">http:</a>


<script language="JavaScript" src="mailto.js"></script>


And then in mailto.js:

for (var i=0; i<document.links.length; i++) {
  if (document.links[i].href.indexOf('mailto:') > -1) {
    document.links[i].href += '?subject=' + escape('Hello world');

©2018 Martin Webb