javascript update controls onload
<p>iv'e got 2 html pages 
one performs a "get" method on the other 
these pages are duplicates in that they own they both poses a form with the same control types 
and control names</p>

<p>when i submit my form from the source page my url string consist of the values appended together after a '?' char </p>

<pre><code>  ....?txtName=era&amp;txtAge=28&amp;gender=male&amp;langHe=on&amp;langEn=on&amp;select=1   
</code></pre>

<p>in the detestation page onload i call a function which splits the control names and their values and sets them </p>

<pre><code>        // this is called from &lt;body onload="f();"&gt;
        function f() {
        var st = new String(location.search);
        st = st.substring(1, st.length);                        
        var input = st.split('&amp;');

        var value;
        var ctrl;
        var val;
        var _control; 

        for (var i = 0; i &lt; input.length; i++) 
        {
            value = input[i].substring(0, input[i].length);
            ctrl = value.substring(0, value.indexOf('='));
            val = value.substring(value.indexOf('=') + 1, value.length);
            _control = document.getElementsByName(ctrl);                
            _control.value = val; 
        }                                                                        
    }
</code></pre>

<p>i debugged this function and checked that every thing is put in to place as it should 
<strong>the problem</strong> is that after the value are set to the controls<br>
they do not appear on the page , as if they didn't get set at all </p>

<p>additionally in Google chrome i get a "Aw,Snap!" Error after these actions  (Aw Snap happens only when i debug  )</p>

<p>i'm new to java-script and i'm guessing there's a problem with the way i'm assigning these values , i tried also just the first control which is a text type input and it also does not get updated  .</p>

<p>any idea's on why this doesn't work ?
thanks in advance
eran. </p>
