i have a main.js that handles Key pressed. and i have a index.html that i want to recieve some variables from main.js and make decisions about it. for example i want to send a url from main.js to index.html .. i try this code in my main.js but not worked.

```
document.getElementById("url").value = "http://example.com";

```

in my index.html i have:

```
<form name="Params">
<input id="url" type="hidden" value="">
</form>

```

i just want to set value of my url input object from main.js.
any help?