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 9 of 9
  1. #1
    New Coder
    Join Date
    Jan 2004
    Location
    watertown,SD
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Cool ComboBox(Quadrouple)...showing values

    This is my first post!

    I modified the quadrouple combobox in one of the previous threads, but I would like a window.alert to pop up and show me my selections at the end. I can't figure out which var holds the value of the combobox (if any). example:

    <select name="example" size="1" onChange="redirect(this.options.selectedIndex)">
    <option selected>---Select Base Commodity-------------</option>
    <option value="S">Steel</option>
    <option value="P">Parishable</option>
    <option value="G">Glass</option> etc.....

    <select name="example1" size="1" onChange="redirect1(this.options.selectedIndex)">
    <option selected>---Select Group-------------</option>
    <option value="F">Flat</option>
    <option value="B">Bar</option>
    <option value="T">Tube</option>etc......


    If I select "STEEL" from the first combo box, I want the window.alert to read "T", if "Tube" is my second selection, I want the window.alert to read "S T". Get it? Thanks for your help!!

  • #2
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    d = document.forms[0];
    alert(d.example.value + d.example1.value);
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

  • #3
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts

    ...and

    ...and...

    <option selected value="">
    or
    <option selected value=" - ">
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

  • #4
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    or, more comprehensive (but only for browsers which support this DHTML method - IE5+, NS6+ and compatible) u may use:

    d = document.getElementsByTagName('select');
    dd="";
    for(i=0;i<d.length;i++){
    dd = dd+d[i].value;
    }
    alert(dd);
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

  • #5
    New Coder
    Join Date
    Jan 2004
    Location
    watertown,SD
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    thank you thank you!!

    That worked great! Thanks everyone!!

  • #6
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    Thanks everyone!!
    everyone (all 3 of us ) wish you a well coding... And good luck!

    I hope you have found here a good place for solving your present/future script problems.
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

  • #7
    New Coder
    Join Date
    Jan 2004
    Location
    watertown,SD
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    another question!

    What do I do to change the output to a text box instead of an alert?

  • #8
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    ....

    d = document.getElementsByTagName('select');
    dd="";
    for(i=0;i<d.length;i++){
    dd = dd+d[i].value;
    }
    document.forms[0].alerthere.value = dd;

    ..

    <body>
    ...
    ...
    <input name="alerthere" type="text" readonly="true">
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

  • #9
    New Coder
    Join Date
    Jan 2004
    Location
    watertown,SD
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question

    Thanks Kor. That worked perfectly. I have another post called "Sooo Slow" can you look at it??? This script is slow at loading. Do you see any reason for this?? Every thing is working perfectly and I am ready to use it! Thanks! (I love this place!)


  •  

    Posting Permissions

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