Twitter dev provide the following code for adding a 'Tweet' button to your site.

Code:
</script>
<a href="https://twitter.com/intent/tweet?text=Text1%20Text2" data-lang="en">Tweet</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
I'm a javascript newbie and what I would like to do is replace 'Text1' and 'Text2' values in the URL with textfield values from a form.

Can anybody advise?

Thanks.