I have the following code working to pass a URL parameter to a form tag:
Change the function onload to this:
function onLoad() {
var value = getQueryVariable("ID");
var e = document.getElementById('your-field');
e.value = value;
var url = "http://www.mysite.com?source=" + value;
var element = document.getElementById('YOUR__ELEMENT_ID');
element.setAttribute("href",url)
}
I'm using the piece of code that Joao Almeida suggested so his example using jQuery works good too.
Good Luck!