Powered By Blogger

Monday, 22 April 2013

Fetch the value of query string parameter.


The following script let you fetch the value of query string parameter.

ex: localhost/purchase/update.html?&id=12

If you want the value of parameter 'id' which is 12.
Split the URL with particular parameter name i.e Modify line no. 3 in script.


Code:

<script language="javascript">
            function load()
            {
                url=document.location.href;
                urln=url.toString();
                id=urln.split("id=");
                document.getElementById("idn").value=id[1];
            }

</script>


No comments:

Post a Comment