need help in passing URL parameters to variables
<p>i need help with a little code that i have below. i'm a newbie in javascript so i hope someone could help me here</p>

<p>i've used the function below to grab parameters from URL:</p>

<pre><code>&lt;script type="text/javascript"&gt;
function gup( name )
 {
 name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
 var regexS = "[\\?&amp;]"+name+"=([^&amp;#]*)";
 var regex = new RegExp( regexS );
 var results = regex.exec( window.location.href );
 if( results == null )
  return "";
 else
  return results[1];
 }
&lt;/script&gt;
</code></pre>

<p>now the problem is that i need to set that parameters into variable so i can use that variable into something else.</p>

<p>for instance i have below form:</p>

<pre><code>&lt;form method="get" action="#" name="dealer"&gt;
   insert dealer code&lt;br /&gt;
   &lt;input type="text" name="dcode" /&gt;
   &lt;input type="submit" value="submit" /&gt;
&lt;/form&gt;
</code></pre>

<p>so whenever i pressed submit button, URL will have parameter. i want to use this parameter as variable. here is the output code</p>

<pre><code>var dealer_param = gup( 'dcode' );
document.write(dealer_param);
</code></pre>

<p>again for instance i have define variables:</p>

<pre><code>var a1 = "John Doe"
var a2 = "Jane Doe"
</code></pre>

<p>now i want to type a1 in the form box and when i pressed submit i want javascript gave me John Doe as the output and not a1 as i'm currently have</p>

<p>i hope it's not much of a confusing question</p>

<p>thanks in advance</p>

<p>~aji</p>
