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 10 of 10
  1. #1
    New to the CF scene
    Join Date
    Mar 2004
    Location
    Kitchener, ON, Cda
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Adding Options to the triple combo box.

    Ok, for starters let me set you up with the two scripts.

    Here is the original. What it's supposed to do, anyway.

    and here is what is going on since I've edited it.

    What I've done:

    I changed this...

    Code:
    <select name="example" size="1" onChange="redirect(this.options.selectedIndex)">
    <option selected>---Select1-------------</option>
    <option>Webmaster Sites</option>
    <option>News Sites</option>
    </select>
    to this...

    Code:
    <select name="example" size="1" onChange="redirect(this.options.selectedIndex)">
    <option selected>Choose a Destination</option>
    <option>Skwid's Lair</option>
    <option>Affiliates</option>
    </select>
    and I changed this...

    Code:
    var groups=document.isc.example.options.length
    var group=new Array(groups)
    for (i=0; i<groups; i++)
    group[i]=new Array()
    
    group[0][0]=new Option("---Select2---"," ");
    
    group[1][0]=new Option("Now Select This One"," ");
    group[1][1]=new Option("JavaScript","47");
    group[1][2]=new Option("DHTML","46");
    group[1][3]=new Option("CGI","45");
    
    group[2][0]=new Option("Now Select This One"," ");
    group[2][1]=new Option("General News","115");
    group[2][2]=new Option("Technology News","116");
    to this...

    Code:
    var groups=document.isc.example.options.length
    var group=new Array(groups)
    for (i=0; i<groups; i++)
    group[i]=new Array()
    
    group[0][0]=new Option("---Select2---"," ");
    
    group[1][0]=new Option("Now Select This One"," ");
    group[1][1]=new Option("Home","47");
    group[1][2]=new Option("New Members","46");
    group[1][3]=new Option("Support","45");
    group[1][4]=new Option("Lounge","44");
    group[1][5]=new Option("Morrowind","43");
    
    group[2][0]=new Option("Now Select This One"," ");
    group[2][1]=new Option("Lair Sites","115");
    group[2][2]=new Option("Member Sites","116"); 
    group[2][3]=new Option("Link Backs","117");
    group[2][4]=new Option("Morrowind","118");
    and finally, I changed this...

    Code:
    var secondGroups=document.isc.stage2.options.length
    var secondGroup=new Array(groups)
    for (i=0; i<groups; i++)  {
    secondGroup[i]=new Array(group[i].length)
    for (j=0; j<group[i].length; j++)  {
    secondGroup[i][j]=new Array()  }}
    
    secondGroup[0][0][0]=new Option("---Select 3---"," ");
    secondGroup[1][0][0]=new Option("---Select 3---"," ");
    secondGroup[1][1][0]=new Option("Now Select This One"," ");
    secondGroup[1][1][1]=new Option("JavaScript Kit","http://javascriptkit.com");
    secondGroup[1][1][2]=new Option("JavaScript for the non programmer","http://webteacher.com/javascript/");
    secondGroup[1][1][3]=new Option("Java-Scripts.net","http://java-scripts.net");
    
    secondGroup[1][2][0]=new Option("Now Select This One"," ");
    secondGroup[1][2][1]=new Option("Dynamic Drive","http://www.dynamicdrive.com");
    secondGroup[1][2][2]=new Option("Beginner\'s Guide to 
    
    DHTML","http://www.geocities.com/ResearchTriangle/Facility/4490/");
    secondGroup[1][2][3]=new Option("Web Coder","http://webcoder.com/");
    
    secondGroup[1][3][0]=new Option("Now Select This One"," ");
    secondGroup[1][3][1]=new Option("CGI Resources","http://www.cgi-resources.com");
    secondGroup[1][3][2]=new Option("Ada\'s Intro to CGI","http://adashimar.hypermart.net/");
    
    secondGroup[2][0][0]=new Option("---Select 3---"," ");
    secondGroup[2][1][0]=new Option("Now Select This One"," ");
    secondGroup[2][1][1]=new Option("CNN","http://www.cnn.com");
    secondGroup[2][1][2]=new Option("MSNBC","http://www.msnbc.com");
    secondGroup[2][1][3]=new Option("ABC News","http://www.abcnews.com");
    
    secondGroup[2][2][0]=new Option("Now Select A Page"," ");
    secondGroup[2][2][1]=new Option("News.com","http://www.news.com");
    secondGroup[2][2][2]=new Option("Wired","http://www.wired.com");
    to this...

    Code:
    var secondGroups=document.isc.stage2.options.length
    var secondGroup=new Array(groups)
    for (i=0; i<groups; i++)  {
    secondGroup[i]=new Array(group[i].length)
    for (j=0; j<group[i].length; j++)  {
    secondGroup[i][j]=new Array()  }}
    
    secondGroup[0][0][0]=new Option("---Select 3---"," ");
    secondGroup[1][0][0]=new Option("---Select 3---"," ");
    secondGroup[1][1][0]=new Option("Now Select This One"," ");
    secondGroup[1][1][1]=new Option("Portal","http://javascriptkit.com");
    secondGroup[1][1][2]=new Option("Forum","http://webteacher.com/javascript/");
    
    secondGroup[1][2][0]=new Option("Now Select This One"," ");
    secondGroup[1][2][1]=new Option("Guests","http://www.dynamicdrive.com");
    secondGroup[1][2][2]=new Option("Member Introductions","http://www.geocities.com/ResearchTriangle/Facility/4490/");
    secondGroup[1][2][3]=new Option("Calendar","http://");
    secondGroup[1][2][4]=new Option("Inbox","http://");
    
    secondGroup[1][3][0]=new Option("Now Select This One"," ");
    secondGroup[1][3][1]=new Option("FAQ","http://www.cgi-resources.com");
    secondGroup[1][3][2]=new Option("Members","http://adashimar.hypermart.net/");
    secondGroup[1][3][3]=new Option("Staff","http://adashimar.hypermart.net/");
    secondGroup[1][3][4]=new Option("Feedback","http://adashimar.hypermart.net/");
    
    secondGroup[1][4][0]=new Option("Now Select This One"," ");
    secondGroup[1][4][1]=new Option("Forum Chat","http://www.cgi-resources.com");
    secondGroup[1][4][2]=new Option("Recreation","http://adashimar.hypermart.net/");
    secondGroup[1][4][3]=new Option("Fun","http://adashimar.hypermart.net/");
    secondGroup[1][4][4]=new Option("Member Boards","http://adashimar.hypermart.net/");
    
    secondGroup[1][5][0]=new Option("Now Select This One"," ");
    secondGroup[1][5][1]=new Option("General","http://www.cgi-resources.com");
    secondGroup[1][5][2]=new Option("Cheats","http://adashimar.hypermart.net/");
    secondGroup[1][5][3]=new Option("Mods and the Construction Set","http://adashimar.hypermart.net/");
    secondGroup[1][5][4]=new Option("Releases","http://adashimar.hypermart.net/");
    secondGroup[1][5][5]=new Option("Screen Shots"."http://");
    
    secondGroup[2][0][0]=new Option("---Select 3---"," ");
    secondGroup[2][1][0]=new Option("Now Select This One"," ");
    secondGroup[2][1][1]=new Option("Terra Obscura","http://www.cnn.com");
    secondGroup[2][1][2]=new Option("DWF","http://www.msnbc.com");
    secondGroup[2][1][3]=new Option("Skwid's Lair: Ver.1.","http://www.abcnews.com");
    
    secondGroup[2][2][0]=new Option("Now Select A Page"," ");
    secondGroup[2][2][1]=new Option("Sanctum of Insanity","http://www.news.com");
    secondGroup[2][2][2]=new Option("The Consortium","http://www.wired.com");
    secondGroup[2][2][3]=new Option("Dark Assassins","http://www.wired.com");
    secondGroup[2][2][4]=new Option("Cat's Crypt","http://www.wired.com");
    secondGroup[2][2][5]=new Option("Val's Castle","http://www.wired.com");
    secondGroup[2][2][6]=new Option("Rogue's End Tavern","http://www.wired.com");
    So, basically...what I did was add new options. The only actual text I changed was exactly that: Display text. I haven't even changed the links yet.

    I 'think' my problem lies in the section after that first. I'm not js guru, by any stretch of the imagination...but I feel that I need to define how many options I'm planning on having. I just don't know how to do that.

    The section that I 'think' needs to be changed is:

    Code:
    <select name="stage2" size="1" onChange="redirect1(this.options.selectedIndex)">
    <option value=" " selected> </option>
    <option value=" " selected>---Select2--------------</option>
    <option value=" " selected>---Select2--------------</option>
    </select>
    
    <select name="stage3" size="1" onChange="redirect2(this.options.selectedIndex)">
    <option value=" " selected> </option>
    <option value=" " selected>---Select3----------------</option>
    <option value=" " selected>---Select3----------------</option>
    </select>
    But I have no idea if I'm right about that.

    Have I been specific enough? Can anyone help me?

    Pretty please? Help keep an aging forum admin out of the Sanitarium for one more year.

  • #2
    New to the CF scene
    Join Date
    Mar 2004
    Location
    Kitchener, ON, Cda
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Ok, a bit of an update.

    After messing around with the script some more, I found that I can add options into the second combo box no problem. It's when I add them into the third that a problem arises. I can add options to an existing group, but when I start a whole new group, like a fourth one
    Code:
    secondGroup[1][4][0]=new Option("Now Select This One", ");
    secondGroup[1][4][1]=new Option("PHP FAQ","http://www.php-faq.ca");
    That's when the script stops working.

    Hope this helps for anyone who's willing to help me.

    Thank you.

  • #3
    Banned
    Join Date
    Sep 2003
    Posts
    3,620
    Thanks
    0
    Thanked 0 Times in 0 Posts
    One slight error on line 104 which is breaking the script.
    Change the highlighted period to a comma and it will work.

    secondGroup[1][5][5]=new Option("Screen Shots"."http://");

    .....Willy

  • #4
    New to the CF scene
    Join Date
    Mar 2004
    Location
    Kitchener, ON, Cda
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Nice catch...I didn't see that.

    However, the script still does not work.

    Anyone know what else it could be?

  • #5
    Banned
    Join Date
    Sep 2003
    Posts
    3,620
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You must either be doing something wrong,
    Or made additional changes.

    It worked for me when I tested it.
    How do you think I found it?

    ....Willy

    Edit: I just looked at your page, and you didn't even fix what I pointed out.
    Gheeesh, I wonder what could be wrong?
    Last edited by Willy Duitt; 03-22-2004 at 12:43 AM.

  • #6
    New to the CF scene
    Join Date
    Mar 2004
    Location
    Kitchener, ON, Cda
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Yes, I changed it locally.

    It didn't work for me. I'll update the page here as well...sorry.

    Not sure how it managed to work for you...cuz I can't get it to work for nuthin.

  • #7
    New to the CF scene
    Join Date
    Mar 2004
    Location
    Kitchener, ON, Cda
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Ok, uploaded the new menuscript2.html.

    And it still doesn't work.

    The only change I made was that period. I changed it to a comma. I touched nothing else.

    I am running IE 6 on a winXP Home edition laptop.

  • #8
    Banned
    Join Date
    Sep 2003
    Posts
    3,620
    Thanks
    0
    Thanked 0 Times in 0 Posts
    It's not working now because you are missing a double quote on line 51.

    eg: Line 51: group[2][4]=new Option("Morrowind","118");

    And if you look up on your first post you will see the double quote was not missing there or on the example page you supplied a link too and which I debugged to start with.

    Please remember, you can not work from two seperate scripts and expect that debugging one will necassarily debug the other.

    .....Willy

  • #9
    New to the CF scene
    Join Date
    Mar 2004
    Location
    Kitchener, ON, Cda
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Ok...sorry about that.

    Thank you, Willy, for all your help. I very much appreciate it. It's working now.

    This is why I never got into programming...

  • #10
    Banned
    Join Date
    Sep 2003
    Posts
    3,620
    Thanks
    0
    Thanked 0 Times in 0 Posts
    No problem. Glad I could help.
    But, debugging is not hard if you use the right tools.
    Either download Netscape and use the Javascript Console, turn Debugging on in IE, or download the Microsoft Debugger for IE.

    Actually, the errors jumped right out at me when I ran your codes.
    All I needed to do was read the lines which were alerted and look for the problem(s).

    .....Willy


  •  

    Posting Permissions

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