JAVASCRIPT: get variable value from URL

I have been trying to make a dynamic map getting the address from the URL with google maps api. i have been literally searching for tutorials and reading documentation and could never do it. i finally found this tutorial:
http://www.developer.com/lang/jscript/article.php/3615681

and i think i kinda got it already. the only thing i have to do now is pass the variable value from a link to javascript.

Lets say i have this link:


<a href="test.php?address=100+Main+St">link</a>

How can I retrieve that in javascript?

I see you can declare a variable like this:
var address = “100 Main St”;

But I can’t declare the variable just like that, I need to get the value from the URL. Im also using php, if that helps.

Thanks in advance,

Leo