I just need to get the value of idi variable from the url.
Everything works fine in the below code except splitting "&". 
Example: if this is the url: www.site.com/page?idi=22&selse=88
i want to get the idi parameter's value from the url and print it as a value of a hidden text input field.
<script>
q=window.location.search.substring(1);
idi="idi";
sq=q.split("&");
l=sq.length;
for(i=0;i<=l;i++)
{  
qv=sq[i].split("="); 
if(qv[0]==idi)
{
qvr=qv[1].Split('&');
document.write(<input type='text' value='"+qvr[0]+"' name='get-idi'/>");
break;
}
}
</script>
Improve or help me form a script for this. Thank you!
 
     
     
     
    