# Help with url query string

**URL:** https://forum.kirupa.com/t/help-with-url-query-string/281488
**Category:** Uncategorized
**Created:** [February 9, 2009, 10:04pm UTC](https://forum.kirupa.com/t/help-with-url-query-string/281488 "2009-02-09T22:04:12Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Navarone](https://avatars.discourse-cdn.com/v4/letter/n/f9ae1b/32.png) [@Navarone](https://forum.kirupa.com/u/Navarone)
#### Post date: [February 9, 2009, 10:04pm UTC](https://forum.kirupa.com/t/help-with-url-query-string/281488/1 "2009-02-09T22:04:12Z")

</div>

I am having trouble with part of my code. There are 3 variables, isOn, isMedia and isPhoto. When I pass the values in via my url query string, I can’t get the following lines of code to work. What is supposed to happen is if isOn==1 then turn on the selected state, then if isOn==1 and isMedia==1 then keep the current selected state on but now also turn on isMedia’s selected state. Any help appreciated.

[http://dev-miller.virtualhorizons.com/miller\_media.htm?isOn=8](http://dev-miller.virtualhorizons.com/miller_media.htm?isOn=8)

```php

var qsParm = new Array();
function qs() {
    var query = window.location.search.substring(1);
    var parms = query.split('&');
    for (var i=0; i<parms.length; i++) {
        var pos = parms*.indexOf('=');
        if (pos > 0) {
            var key = parms*.substring(0,pos);
            var val = parms*.substring(pos+1);
            qsParm[key] = val;
        }
    }
} 

qsParm['isOn'] = null;
qsParm['isPhoto'] = null;
qsParm['isMedia'] = null;

qs(); 

...

} else if (qsParm['isOn']==8){
    document.getElementById('media').className ="menu_item_media_selected";

} else if (qsParm['isOn']==8 && qsParm['isMedia']==1){
    document.getElementById('media').className ="menu_item_media_selected";    
    document.getElementById('media_photos').className ="media_item_text_selected";
    document.getElementById('b11').className ="photo_menu_item_selected";
...

```
