Adding a link to a page using the Querystring content in javascript

Below is the code to create a link in a page which includes some value from the querystring of the current page.

var qsParm = new Array();
function qs()
     var query =;
     var parms = query.split('&');
     for (var i=0; i<parms.length; i++)

         var pos = parms[i].indexOf('=');
         if (pos > 0)

             var key = parms[i].substring(0,pos);

             var val = parms[i].substring(pos+1);
             qsParm[key] = val;
qsParm['ID'] = null;
var addressTr= "Technical%20View.aspx?ID=" +  qsParm['ID'] ;
document.write('<a target="_self" href="' + addressTr + '">Technical View</a>');


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

Create a website or blog at

Up ↑

%d bloggers like this: