i decided to get fancy with this code from fang and fell on my face. i have repeated this code(which works btw) and changed the ('field_') bit and it reads the first and third but not the second var why?
some.html?f=1&d=2&c=3
if i cahange the substring to correspond to the var to (2) it reads f and d
if i add the third one calling substring (3) it wont read (2) but reads 1 and 3
any suggestions.

<SCRIPT type=text/javascript>
window.onload=function() {
var data=location.search;
if(data) {
data=location.search.substring(1); // remove the '?'
data=data.split('&');
var pairs={};
for(var i=0; i<data.length; i++){
var tmp=data[i].split('=');
pairs[tmp[0]]=tmp[1];
}
document.getElementById('field_1').value = tmp[1];
}
};
</SCRIPT>