Here is a small function that will parse the window.location.href value and return the value for the parameter you specify.
<script type=”text/javascript”>
function get_url_parameter( param ){
param = param.replace(/[\[]/,”\\\[").replace(/[\]]/,”\\\]”);
var r1 = “[\\?&]“+param+”=([^&#]*)”;
var r2 = new RegExp( r1 );
var r3 = r2.exec( window.location.href );
if( r3 == null )??? return “”;
else??? return r3[1];
}
</script>
Suppose you have the following URL:
http://www.domain.com/index.html?test=123
And you want to get the value of the test paramater, here is how to do that:
var test_value = get_url_parameter(‘test’);
Now the test_value variable contains 123.