In this article I will explain with an example, how to read (fetch) QueryString values from URL in HTML.
Redirecting with QueryString parameters using JavaScript
The following HTML Markup consists of an HTML TextBox, a DropDownList and a Button.
The Button has been assigned a JavaScript Click event handler which invokes the Send JavaScript function.
Inside the Send JavaScript function, the values of the TextBox and DropDownList are fetched and are encoded using the JavaScript encodeURIComponent function and added as QueryString parameters to a URL.
Finally, the page is redirected to the URL.
<input type="text" id="txtName" name="Name" value="Mudassar Khan" /><br />
<br />
<select id="ddlTechnolgy" name="Technology">
    <option value="ASP.Net">ASP.Net</option>
    <option value="PHP">PHP</option>
    <option value="JSP">JSP</option>
<input type="button" value="Send" onclick = "Send()" />
<script type="text/javascript">
    function Send() {
        var name = document.getElementById("txtName").value;
        var tech = document.getElementById("ddlTechnolgy").value;
        var url = "Page2.htm?name=" + encodeURIComponent(name) + "&technology=" + encodeURIComponent(tech);
        window.location.href = url;
Reading (Fetching) QueryString values
The following HTML Markup consists of an HTML SPAN.
Inside the Window OnLoad event handler, the QueryString is extracted by splitting the URL of the current page using the Question mark (?) character.
Then a loop is executed and each QueryString parameter value is extracted by further splitting using the ampersand (&) character and the extracted values are decoded using the JavaScript decodeURIComponent function inserted as Key and Value pairs into an Array.
Finally, the QueryString parameter values are fetched from the Array using the name of the QueryString parameter i.e. the Key and displayed in HTML SPAN.
<span id="lblData"></span>
<script type="text/javascript">
    var queryString = new Array();
    window.onload = function () {
        if (queryString.length == 0) {
            if ('?').length > 1) {
                var params ='?')[1].split('&');
                for (var i = 0; i < params.length; i++) {
                    var key = params[i].split('=')[0];
                    var value = decodeURIComponent(params[i].split('=')[1]);
                    queryString[key] = value;
        if (queryString["name"] != null && queryString["technology"] != null) {
            var data = "<u>Values from QueryString</u><br /><br />";
            data += "<b>Name:</b> " + queryString["name"] + " <b>Technology:</b> " + queryString["technology"];
            document.getElementById("lblData").innerHTML = data;
Read (Fetch) QueryString values in HTML
Browser Compatibility

The above code has been tested in the following browsers.
Internet Explorer  FireFox  Chrome  Safari  Opera 

* All browser logos displayed above are property of their respective owners.