The JavaScript

The JavaScript uses two functions to parse the query string and check for data appropriate for specifying iframe src: getValueFromQueryString and checkQuery4Iframe.

You set up the data to pass to the checkQuery4Iframe in an object literal. You include the id of the iframe and lookup values and URLs that may be displayed in this iframe:

var iframe_props = {
    id: 'ifrm', // id of iframe
    urls: { // lookup values and urls to load in iframe 
        'dflt': 'your.html', // a default page
        'pg2': 'your2.html',
        // full URL example
        'pg3': 'http://www.yourdomain.com/page.html'
    }
};

You can place the call to the checkQuery4Iframe function below the iframe, or you can call it onload or using some version of document.ready:

checkQuery4Iframe(iframe_props);

An example is included in the download file.