How to handle Querystring in JavaScript?
<p>I have a js code:</p>

<pre><code>    window.onload = function() {
        document.getElementById("Button1").onclick = function() {
            var t1 = document.getElementById("Text1").value;
            var t2 = document.getElementById("Text2").value;

            document.URL = 'myurl?t1=' + t1 + '&amp;t2' + t2;
         }
    }
</code></pre>

<p>Here i am adding t1,t2 as query param..now my question is lets say i have entered some data in Textbox1 but not in textbox2, in that case the url I am getting is 
<code>'myurl?t1=' + value of textbox1 + '&amp;t2' + This will be blank;</code>
I want to make it dynamic, i.e.if there is not value in Textbox2 then I dont want to append queryparam t2, same goes for t1 also..isit possible?</p>
