How to get the querystring with javascript and if there is no querystring
<p>I have the following code to taket the querystring value and return different links depending on which filter a user selected (that reloads the page with a querystring).</p>

<p>It works fine if a user selects a filter and the page reloads. Howver, the first time the page is loaded there is no querystring and the javascript breaks causing some images/links to not be shown. Code below</p>

<pre><code>var goPage=new Array(6);

var search = location.search;
search = search.replace(/\?/,'');
var searchAttributes = search.split('&amp;');

for(var no=0;no&lt;searchAttributes.length;no++){
    var items = searchAttributes[no].split('=');
    eval("var "+items[0]+" = '"+items[1]+"';");
}
queryString = SelectedID;

var goPage=new Array(6);

if (queryString == "")
{
goPage[0]='https://company.sharepoint.apac.microsoftonline.com/Lists/Strategic%20Items/Objective%20Status.aspx';
goPage[1]='https://company.sharepoint.apac.microsoftonline.com/Lists/Strategic%20Items/Priorities%20Status.aspx';
goPage[2]='https://company.sharepoint.apac.microsoftonline.com/Lists/Strategic%20Items/Milestone%20Status.aspx';
goPage[3]='https://company.sharepoint.apac.microsoftonline.com/Lists/Strategic%20Items/Moved%20to%20Green%20Last%2030.aspx';
goPage[4]='https://company.sharepoint.apac.microsoftonline.com/Lists/Strategic%20Items/Moved%20to%20Amber%20Last%2030.aspx';
goPage[5]='https://company.sharepoint.apac.microsoftonline.com/Lists/Strategic%20Items/Moved%20to%20Red%20Last%2030.aspx';
}

if (queryString == 25)
{
goPage[0]='https://company.sharepoint.apac.microsoftonline.com/Lists/Strategic%20Items/Objective%20Status.aspx?View={D2ADE53F-8C47-4787-80AE-6F90C84206B5}&amp;FilterField1=Strategic_x0020_ObjectiveFilterValue1=A.%20Industry%20leadership%20through%20technical%20excellence%2C%20self%20performance%2C%20safety%20and%20environment';

goPage[1]='company.sharepoint.apac.microsoftonline.com/Lists/Strategic%20Items/Priorities%20Status.aspx?SortField=Strategic_x0020_Objective&amp;SortDir=Asc&amp;View={9AE43100-E1E7-4705-A4C5-D8FE7326714E}&amp;FilterField1=Strategic_x0020_Objective&amp;FilterValue1=A.%20Industry%20leadership%20through%20technical%20excellence%2C%20self%20performance%2C%20safety%20and%20environment';

goPage[2]='company.sharepoint.apac.microsoftonline.com/Lists/Strategic%20Items/Milestone%20Status.aspx?View={F9DFB655-BB78-4A66-8F65-98D37B07B9B5}&amp;FilterField1=Strategic_x0020_Objective&amp;FilterValue1=A.%20Industry%20leadership%20through%20technical%20excellence%2C%20self%20performance%2C%20safety%20and%20environment';

goPage[3]='company.sharepoint.apac.microsoftonline.com/Lists/Strategic%20Items/Moved%20to%20Green%20Last%2030.aspx';

goPage[4]='company.sharepoint.apac.microsoftonline.com/Lists/Strategic%20Items/Moved%20to%20Amber%20Last%2030.aspx?View={E2142842-9815-4FFC-9297-C0F0D8E93796}&amp;FilterField1=Strategic_x0020_ObjectiveFilterValue1=A.%20Industry%20leadership%20through%20technical%20excellence%2C%20self%20performance%2C%20safety%20and%20environment';

goPage[5]='company.sharepoint.apac.microsoftonline.com/Lists/Strategic%20Items/Moved%20to%20Red%20Last%2030.aspx';
}
</code></pre>

<p>Any suggestions on how to change the way I get the querystring so if there is none the javascript won't break?</p>
