Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Oct 2008
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Duel Combo box with Iframe

    How can i make a combo box open in a iframe it's a java script with all the var and Array scripting please help me here is the script.THERE IS A LOT OF JUNK IN HERE JUST AS A TEST SO JUST IGNORE

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>OSBT Web Pricing</title>
    </head>

    <body>
    <table width="739" border="0" cellpadding="0" cellspacing="0">
    <!--DWLayoutTable-->

    <tr>
    <td width="730" height="25" valign="top"><script language="JavaScript">
    <!--

    //Double Combo Box with Description Code- by Randall Wald (http://www.rwald.com)
    //Visit JavaScript Kit (http://javascriptkit.com) for script
    //Credit must stay intact for use

    var num_of_cats = 5; // This is the number of categories, including the first, blank, category.
    var open_in_newwindow=1; //Set 1 to open links in new window, 0 for no.
    var option_array = new Array(num_of_cats);

    option_array[0] = new Array("You need to select a category"); // This is the first (blank) category. Don't mess with it.

    option_array[1] = new Array("-- Sound Manufacture --",
    "AKG",
    "Ashly",
    "Atlas",
    "Audio Technica",
    "Audix",
    "Aviom",
    "Bag End",
    "Bi Amp",
    "Bogen",
    "BSS",
    "Chauvet",
    "Chief",
    "Community",
    "Crown",
    "DBX",
    "AKG",
    "Ashly",
    "Atlas",
    "Audio Technica",
    "Audix",
    "Aviom",
    "Bag End",
    "Bi Amp",
    "Bogen",
    "BSS",
    "Chauvet",
    "Chief",
    "Community",
    "Crown",
    "DBX",
    "AKG",
    "Ashly",
    "Atlas",
    "Audio Technica",
    "Audix",
    "Aviom",
    "Bag End",
    "Bi Amp",
    "Bogen",
    "BSS",
    "Chauvet",
    "Chief",
    "Community",
    "Crown",
    "DBX",
    "AKG",
    "Ashly",
    "Atlas",
    "Audio Technica",
    "Audix",
    "Aviom",
    "Bag End",
    "Bi Amp",
    "Bogen",
    "BSS",
    "Chauvet",
    "Chief",
    "Community",
    "Crown",
    "DBX",
    "AKG",
    "Ashly",
    "Atlas",
    "Audio Technica",
    "Audix",
    "Aviom",
    "Bag End",
    "Bi Amp",
    "Bogen",
    "BSS",
    "Chauvet",
    "Chief",
    "Community",
    "Crown",
    "DBX" );


    option_array[2] = new Array("-- Video Manufacture --",
    "AKG",
    "Ashly",
    "Atlas",
    "Audio Technica",
    "Audix",
    "Aviom",
    "Bag End",
    "Bi Amp",
    "Bogen",
    "BSS",
    "Chauvet",
    "Chief",
    "Community",
    "Crown",
    "DBX",
    "AKG",
    "Ashly",
    "Atlas",
    "Audio Technica",
    "Audix",
    "Aviom",
    "Bag End",
    "Bi Amp",
    "Bogen",
    "BSS",
    "Chauvet",
    "Chief",
    "Community",
    "Crown",
    "DBX",
    "AKG",
    "Ashly",
    "Atlas",
    "Audio Technica",
    "Audix",
    "Aviom",
    "Bag End",
    "Bi Amp",
    "Bogen",
    "BSS",
    "Chauvet",
    "Chief",
    "Community",
    "Crown",
    "DBX",
    "AKG",
    "Ashly",
    "Atlas",
    "Audio Technica",
    "Audix",
    "Aviom",
    "Bag End",
    "Bi Amp",
    "Bogen",
    "BSS",
    "Chauvet",
    "Chief",
    "Community",
    "Crown",
    "DBX",
    "AKG",
    "Ashly",
    "Atlas",
    "Audio Technica",
    "Audix",
    "Aviom",
    "Bag End",
    "Bi Amp",
    "Bogen",
    "BSS",
    "Chauvet",
    "Chief",
    "Community",
    "Crown",
    "DBX" );

    option_array[3] = new Array("-- Lighting Manufacture --",
    "AKG",
    "Ashly",
    "Atlas",
    "Audio Technica",
    "Audix",
    "Aviom",
    "Bag End",
    "Bi Amp",
    "Bogen",
    "BSS",
    "Chauvet",
    "Chief",
    "Community",
    "Crown",
    "DBX",
    "AKG",
    "Ashly",
    "Atlas",
    "Audio Technica",
    "Audix",
    "Aviom",
    "Bag End",
    "Bi Amp",
    "Bogen",
    "BSS",
    "Chauvet",
    "Chief",
    "Community",
    "Crown",
    "DBX",
    "AKG",
    "Ashly",
    "Atlas",
    "Audio Technica",
    "Audix",
    "Aviom",
    "Bag End",
    "Bi Amp",
    "Bogen",
    "BSS",
    "Chauvet",
    "Chief",
    "Community",
    "Crown",
    "DBX",
    "AKG",
    "Ashly",
    "Atlas",
    "Audio Technica",
    "Audix",
    "Aviom",
    "Bag End",
    "Bi Amp",
    "Bogen",
    "BSS",
    "Chauvet",
    "Chief",
    "Community",
    "Crown",
    "DBX",
    "AKG",
    "Ashly",
    "Atlas",
    "Audio Technica",
    "Audix",
    "Aviom",
    "Bag End",
    "Bi Amp",
    "Bogen",
    "BSS",
    "Chauvet",
    "Chief",
    "Community",
    "Crown",
    "DBX" );

    option_array[4] = new Array("-- Rigging Manufacture --",
    "AKG",
    "Ashly",
    "Atlas",
    "Audio Technica",
    "Audix",
    "Aviom",
    "Bag End",
    "Bi Amp",
    "Bogen",
    "BSS",
    "Chauvet",
    "Chief",
    "Community",
    "Crown",
    "DBX",
    "AKG",
    "Ashly",
    "Atlas",
    "Audio Technica",
    "Audix",
    "Aviom",
    "Bag End",
    "Bi Amp",
    "Bogen",
    "BSS",
    "Chauvet",
    "Chief",
    "Community",
    "Crown",
    "DBX",
    "AKG",
    "Ashly",
    "Atlas",
    "Audio Technica",
    "Audix",
    "Aviom",
    "Bag End",
    "Bi Amp",
    "Bogen",
    "BSS",
    "Chauvet",
    "Chief",
    "Community",
    "Crown",
    "DBX",
    "AKG",
    "Ashly",
    "Atlas",
    "Audio Technica",
    "Audix",
    "Aviom",
    "Bag End",
    "Bi Amp",
    "Bogen",
    "BSS",
    "Chauvet",
    "Chief",
    "Community",
    "Crown",
    "DBX",
    "AKG",
    "Ashly",
    "Atlas",
    "Audio Technica",
    "Audix",
    "Aviom",
    "Bag End",
    "Bi Amp",
    "Bogen",
    "BSS",
    "Chauvet",
    "Chief",
    "Community",
    "Crown",
    "DBX" );


    var text_array = new Array(num_of_cats);

    text_array[0] = new Array("Welcome To OSBT Pricing Guide Online "); // These are general instructions. Change them if you want, or keep them if you don't.

    text_array[1] = new Array("When You Select a Manufacture you will see contact information and discounts.", // Note that the first entry here is a general description of this category. After than, they're descriptions of each link. Make sure that you don't put the first link first; the general description must be first.
    "AKG 800-255-5896",
    "800-586-5858 John Adams.",
    "Wired magazine is the type of magazine which needs no introduction.",
    "AKG 800-255-5896",
    "800-586-5858 John Adams.",
    "Wired magazine is the type of magazine which needs no introduction.",
    "AKG 800-255-5896",
    "800-586-5858 John Adams.",
    "Wired magazine is the type of magazine which needs no introduction.",
    "AKG 800-255-5896",
    "800-586-5858 nygvgyegsuo.",
    "AKG 800-255-5896",
    "800-586-5858 John Adams.",
    "Wired magazine is the type of magazine which needs no introduction.",
    "AKG 800-255-5896",
    "800-586-5858 John Adams.",
    "Wired magazine is the type of magazine which needs no introduction.",
    "AKG 800-255-5896",
    "800-586-5858 John Adams.",
    "Wired magazine is the type of magazine which needs no introduction.",
    "AKG it works",
    "AKG 800-255-5896",
    "800-586-5858 John Adams.",
    "Wired magazine is the type of magazine which needs no introduction.",
    "AKG 800-255-5896",
    "800-586-5858 John Adams.",
    "Wired magazine is the type of magazine which needs no introduction.",
    "AKG 800-255-5896",
    "800-586-5858 John Adams.",
    "Wired magazine is the type of magazine which needs no introduction.",
    "nvsiugsuhgbuhgbuguhgliigubguigisuhsgu");

    text_array[2] = new Array("When You Select a Manufacture you will see contact information and discounts.",
    "AKG 800-255-5896",
    "800-586-5858 John Adams.",
    "Wired magazine is the type of magazine which needs no introduction.",
    "AKG 800-255-5896",
    "800-586-5858 John Adams.",
    "Wired magazine is the type of magazine which needs no introduction.",
    "AKG 800-255-5896",
    "800-586-5858 John Adams.",
    "Wired magazine is the type of magazine which needs no introduction.",
    "AKG 800-255-5896",
    "800-586-5858 nygvgyegsuo.",
    "AKG 800-255-5896",
    "800-586-5858 John Adams.",
    "Wired magazine is the type of magazine which needs no introduction.",
    "AKG 800-255-5896",
    "800-586-5858 John Adams.",
    "Wired magazine is the type of magazine which needs no introduction.",
    "AKG 800-255-5896",
    "800-586-5858 John Adams.",
    "Wired magazine is the type of magazine which needs no introduction.",
    "AKG it works",
    "AKG 800-255-5896",
    "800-586-5858 John Adams.",
    "Wired magazine is the type of magazine which needs no introduction.",
    "AKG 800-255-5896",
    "800-586-5858 John Adams.",
    "Wired magazine is the type of magazine which needs no introduction.",
    "AKG 800-255-5896",
    "800-586-5858 John Adams.",
    "Wired magazine is the type of magazine which needs no introduction.",
    "nvsiugsuhgbuhgbuguhgliigubguigisuhsgu");

    text_array[3] = new Array("When You Select a Manufacture you will see contact information and discounts.",
    "AKG 800-255-5896",
    "800-586-5858 John Adams.",
    "Wired magazine is the type of magazine which needs no introduction.",
    "AKG 800-255-5896",
    "800-586-5858 John Adams.",
    "Wired magazine is the type of magazine which needs no introduction.",
    "AKG 800-255-5896",
    "800-586-5858 John Adams.",
    "Wired magazine is the type of magazine which needs no introduction.",
    "AKG 800-255-5896",
    "800-586-5858 nygvgyegsuo.",
    "AKG 800-255-5896",
    "800-586-5858 John Adams.",
    "Wired magazine is the type of magazine which needs no introduction.",
    "AKG 800-255-5896",
    "800-586-5858 John Adams.",
    "Wired magazine is the type of magazine which needs no introduction.",
    "AKG 800-255-5896",
    "800-586-5858 John Adams.",
    "Wired magazine is the type of magazine which needs no introduction.",
    "AKG it works",
    "AKG 800-255-5896",
    "800-586-5858 John Adams.",
    "Wired magazine is the type of magazine which needs no introduction.",
    "AKG 800-255-5896",
    "800-586-5858 John Adams.",
    "Wired magazine is the type of magazine which needs no introduction.",
    "AKG 800-255-5896",
    "800-586-5858 John Adams.",
    "Wired magazine is the type of magazine which needs no introduction.",
    "nvsiugsuhgbuhgbuguhgliigubguigisuhsgu");


    text_array[4] = new Array("When You Select a Manufacture you will see contact information and discounts.",
    "Rigging",
    "800-586-5858 John Adams.",
    "Wired magazine is the type of magazine which needs no introduction.",
    "AKG 800-255-5896",
    "800-586-5858 John Adams.",
    "Wired magazine is the type of magazine which needs no introduction.",
    "AKG 800-255-5896",
    "800-586-5858 John Adams.",
    "Wired magazine is the type of magazine which needs no introduction.",
    "AKG 800-255-5896",
    "800-586-5858 nygvgyegsuo.",
    "AKG 800-255-5896",
    "800-586-5858 John Adams.",
    "Wired magazine is the type of magazine which needs no introduction.",
    "AKG 800-255-5896",
    "800-586-5858 John Adams.",
    "Wired magazine is the type of magazine which needs no introduction.",
    "AKG 800-255-5896",
    "800-586-5858 John Adams.",
    "Wired magazine is the type of magazine which needs no introduction.",
    "AKG it works",
    "AKG 800-255-5896",
    "800-586-5858 John Adams.",
    "Wired magazine is the type of magazine which needs no introduction.",
    "AKG 800-255-5896",
    "800-586-5858 John Adams.",
    "Wired magazine is the type of magazine which needs no introduction.",
    "AKG 800-255-5896",
    "800-586-5858 John Adams.",
    "Wired magazine is the type of magazine which needs no introduction.",
    "nvsiugsuhgbuhgbuguhgliigubguigisuhsgu");


    var url_array = new Array(num_of_cats);

    url_array[0] = new Array("#"); // The first category. This should have no items other than "#".

    url_array[1] = new Array("#", // The second category; the first "real" category. Note the initial #. That is the category which says "Please select a link." It doesn't need a URL. Start putting the other URL's in after that first line.
    "pricing/akg.pdf/",
    "Atlas/",
    "Audio Technica");

    url_array[2] = new Array("#",
    "http://www.cnn.com/",
    "http://abcnews.go.com/");

    url_array[3] = new Array("#",
    "http://www.google.com/",
    "http://www.aj.com/");

    url_array[4] = new Array("#",
    "http://www.google.com/",
    "http://www.aj.com/");

    function switch_select()

    {
    for (loop = window.document.form_1.select_2.options.length-1; loop > 0; loop--)
    {
    window.document.form_1.select_2.options[loop] = null;
    }

    for (loop = 0; loop < option_array[window.document.form_1.select_1.selectedIndex].length; loop++)
    {
    window.document.form_1.select_2.options[loop] = new Option(option_array[window.document.form_1.select_1.selectedIndex][loop]);
    }

    window.document.form_1.select_2.selectedIndex = 0;
    }

    function switch_text()

    {
    window.document.form_1.textarea_1.value = text_array[window.document.form_1.select_1.selectedIndex][window.document.form_1.select_2.selectedIndex];
    }

    function box()

    {
    if (window.document.form_1.select_2.selectedIndex == 0)
    {
    alert("Where do you think you're going?");
    } else {
    if (open_in_newwindow==1)
    window.open(url_array[window.document.form_1.select_1.selectedIndex][window.document.form_1.select_2.selectedIndex],"iframe");
    else
    window.location=url_array[window.document.form_1.select_1.selectedIndex][window.document.form_1.select_2.selectedIndex]
    }
    }

    function set_orig()

    {
    window.document.form_1.select_1.selectedIndex = 0;
    window.document.form_1.select_2.selectedIndex = 0;
    }

    window.onload=set_orig

    // -->
    </script>

    <form name="form_1" onSubmit="return false;">
    <textarea WRAP="virtual" name="textarea_1" rows=4 cols=40>Welcome to One Source Building Technologies Web Based Pricing Guide</textarea>
    <select name="select_1" onchange="switch_select(); switch_text();">
    <option>-- Categories --</option>
    <option>Sound</option>
    <option>Video</option>
    <option>Lighting</option>
    <option>Rigging</option>
    </select>
    <select name="select_2" onchange="switch_text();">
    <option>You need to select a category</option>
    <option> </option>
    <option> </option>
    </select>
    <input type="submit" onclick="box();" value="Go!" />
    <br /> <!-- This should be the same as the general instructions in the above code. -->
    </form>&#160;</td>
    <td width="9"></td>
    </tr>
    </table>
    <table width="730" border="0" cellpadding="0" cellspacing="0">
    <!--DWLayoutDefaultTable-->
    <tr>
    <td width="730" height="11"></td>
    </tr>
    <tr>
    <td height="59" valign="top"><IFRAME name=stbbox src="iframe.html" width="850" height="725">
    <!-- Courtesy of SimplytheBest.net - http://simplythebest.net/scripts/ -->
    <p>Your browser doesn't support frames. Click <a href="iframe.html" target="_iframe.html">here</a> to view the page.</p>
    </IFRAME>&nbsp;</td>
    </tr>
    </table>
    </body>
    </html>
    Last edited by wsound07; 10-29-2008 at 07:43 PM.

  • #2
    Senior Coder rangana's Avatar
    Join Date
    Feb 2008
    Location
    Cebu City, Philippines
    Posts
    1,752
    Thanks
    65
    Thanked 372 Times in 365 Posts
    Change this part:
    Code:
    window.open(url_array[window.document.form_1.select_1.selectedIndex][window.document.form_1.select_2.selectedIndex],"iframe");
    ...to:
    Code:
    document.getElementsByName('stbbox')[0].setAttribute('src',url_array[window.document.form_1.select_1.selectedIndex][window.document.form_1.select_2.selectedIndex]);
    Also, next time, please use the [code][/code] tags when showing us a code.
    Learn how to javascript at 02geek

    The more you learn, the more you'll realize there's much more to learn
    Ray.ph


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •