I have a couple of menu's that add a variable to the current link uppon click. Here is an example:
<select onChange="window.location.href+=this.value">
<option value="&numb=1">1</option>
<option value="&numb=2">2</option>
<option value="&numb=3">3</option>
</select>
<select onChange="window.location.href+=this.value">
<option value="&cord=x">x</option>
<option value="&cord=y">y</option>
<option value="&cord=z">z</option>
</select>
My problem is then, if I choose "y" 2 times, it adds "&cord=y" 2 times. Instead I want it to replace the current value from that menu. So if "&cord=x" is allready present, it would then just change it to "&cord=y" instead of adding a new variable to the link. Ofcourse, if I choose one from the &numb menu, it shouldn't replace one from the &cord menu.
Can this be done? If yes, then how?
EDIT: Here is another example. If I have the url "www.google.com?cat=p&comp=x&type=1" and I choose "&comp=3" in my select box, It will then replace the current &comp with the new. If &comp is not set, it will just add &comp=3 (or whatever I chose) to the url.