Encountered a problem - I want to include a js-variable in the body of a mail, which users can forward to friends, using the following:
<head>
<script src="javascript.js" type="text/javascript">
</script>
<body>
<script type="text/javascript">
document.write('<a href="mailto:?subject=Subject&body=Bodytext' +total+ '">Mail me</a>');</script>
</body>
The var total is defined in the .js file, and it's value can be manipulated by executing af function attached to a form.
Even after the function is carried out and the page displays the changes, the opened mail will always display the default value of var total instead of the manipulated.
Basically my question is: How do I get the modified var total to display inside the mailto-link, instead of the default var total.
Disclaimer: I'm not very smart (when it comes to coding at least).
Bonus-info: I've made it possible to share the var total with Facebook using FB.init etc., which perfectly displays the manipulated var.
Edit:
JS (cut a bit short):
var total = 'empty';
function getCalculation() {
total = (parseInt(f1) + parseInt(f2)).toFixed(0);
document.contactForm.formTotal.value = total;
}