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': ''

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:


An example is included in the download file.