# How to: Javascript variable in mailto: tag

**URL:** https://forum.kirupa.com/t/how-to-javascript-variable-in-mailto-tag/247307
**Category:** web dev
**Created:** [December 21, 2007, 12:40am UTC](https://forum.kirupa.com/t/how-to-javascript-variable-in-mailto-tag/247307 "2007-12-21T00:40:15Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Pherank](https://avatars.discourse-cdn.com/v4/letter/p/4af34b/32.png) [@Pherank](https://forum.kirupa.com/u/Pherank)
#### Post date: [December 21, 2007, 12:40am UTC](https://forum.kirupa.com/t/how-to-javascript-variable-in-mailto-tag/247307/1 "2007-12-21T00:40:15Z")

</div>

Is this allowed?

If I have a JS function that receives a variable string called “data” - can I reference it within a mailto: tag?

```auto

    function sayHello(data) {
        //alert(" + data+ ");
        return data;
    }

```

And then something like this (I’m not sure what the syntax should look like):

```auto

<a href="mailto:you@yahoo.com*?body=" + data + "*">

```
