Javascript: Pass query string variables to a form

OK, my javascript is pretty rubbish, so can anyone help with the following?

I am passing two variables via a URL to a second page containing a form, e.g. generated URL query string is ‘www.myweb.com?formID=form1&hiddenVar=value1’.

What javascript do I need on the page with the form so that ‘value1’ is passed to the hidden field (lets call it ‘hiddenField1’) in ‘form1’?

THANKS!