[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

9.4

Why doesn't this work ?? :(

Asked by Ninibini in JavaScript

Tags: combobox

I'm trying to make a trivia page for a website ...
take a look at
http://www.geocities.com/bbstory/test/trivia.htm
to see what I've got so far...

Getting the info from the radiobuttons works fine, also which items of the left comboboxs are selected ...

but when I'm trying to get the selected items of the right comboboxes, using "exactly" the same code as for the left, I get wrong results (See alerts on website).

so here's my JavaScript code:

<script language="JavaScript">
<!-- Begin
function button1_onclick()                              //Hauptfunktion, die die Eingaben auswertet
{
      var array_Radio = new Array(4);            //selected radiobutton
      var array_Solution_Radio = new Array("1","2","3","2","1"); //trivia solutions
      
      var array_combo1 = new Array(4);      //selected item - left combo
      var array_combo2 = new Array(4);      //selected item - right combo
      
      var array_Solution_Book = new Array("hm","hm","hm","hm","hm"); //trivia solution left combo
      var array_Solution_Character = new Array("1","2","3","2","1"); //trivia solution right combo
      
      var points=0;
      var tmp;
      var test="";      //just for debugging
      
      //getting results for radiobuttons
      for (x=0;x<5;x++)
      {
            tmp='radio'+(x+1);
            array_Radio[x]=getRadioValue(tmp);
            
            if (array_Radio[x]==array_Solution_Radio[x])
            {
                  points=points+10;
            }
      }
      
      //get combobox value
      
      array_combo1[0]=select1.options[select1.selectedIndex].value;
      array_combo1[1]=select3.options[select3.selectedIndex].value;
      array_combo1[2]=select5.options[select5.selectedIndex].value;
      array_combo1[3]=select7.options[select7.selectedIndex].value;
      array_combo1[4]=select9.options[select9.selectedIndex].value;
      
      //debugging, which items of the left comboboxes are selected      
      for (x=0;x<5;x++)            
      {test=test + array_combo1[x] + " "}            
      alert(test);
      



      
//?????????????????????????????????????????????????????
      
//trying to do the same as above for the right comboboxes
//HELP - why doesn't these lines work?      

                  
      array_combo2[0]=select2.options[select2.selectedIndex].value;
      array_combo2[1]=select4.options[select4.selectedIndex].value;
      array_combo2[2]=select6.options[select6.selectedIndex].value;
      array_combo2[3]=select8.options[select8.selectedIndex].value;
      array_combo2[4]=select10.options[select10.selectedIndex].value;
      
      test="";      
      for (x=0;x<5;x++)            
      {test=test + array_combo2[x] + " "}      //I should get the values here !!!!      
      alert(test);

//????????????????????????????????????????????????????????

      /* //comparing solution with selected items
      for (x=0;x<5;x++)
      {
            alert("aussen: " + array_combo1[x] + " - " + array_Solution_Book[x]);

            if (array_combo1[x]==array_Solution_Book[x])
            {
                  alert("innen: " + array_combo2[x] + " - " + array_Solution_Character[x]);
                              
                  if (array_combo2[x]==array_Solution_Character[x])
                  {
                        points=points+10;
                  }            
            }
      }*/
      
      alert("You've reached " + points + " points");
}

//---------------------------------------------------------      
function getRadioValue(RadioName)            //Aufruf: getRadioValue('radio1')
{
  var collection;
  collection = document.all(RadioName);

  for (j=0;j<3;j++)
  {
    if (collection[j].checked)
    {
                  return [collection[j].value];            //returns selected item
            }
  }
}

//---------------------------------------------------------
function RemoveItems(id)                        //remooves items from combobox
{
      while(id.length!=0)
      {
            id.remove(0);
      }
}

//---------------------------------------------------------
function AddItem(id,str,i)                        //adds new item to combobox
{                                                                        //id:  combobox
      var oOption = document.createElement("OPTION");      //str: text of new item
      id.options.add(oOption);      //i:   value of new item
      oOption.innerText = str;
      oOption.Value = i;
      if(i=="0")
      {
            oOption.selected=true;
      }
}

//---------------------------------------------------------
function create_list(id,val)
{
      RemoveItems(id);
      switch (val)
      {
            case "n/a": AddItem(id,"<not given>",'asdfasdf');
                                    break;
            case "hs":  AddItem(id,"Susannah Faulconer",'a');
                                    AddItem(id,"Sam Gamble","v");
                                    AddItem(id,"Mitchell Blaine","2");
                                    AddItem(id,"Yank Yankowski","3");
                                    AddItem(id,"Paige Faulconer","4");
                                    AddItem(id,"Calvin Theroux ","5");
                                    AddItem(id,"Joel Faulconer","6");
                                    AddItem(id,"Sam & Susannah","7");
                                    AddItem(id,"Mitch & Susannah","8");
                                    break;
            case "hm":      AddItem(id,"Honey Moon",0);
                                    AddItem(id,"Dash Coogan",1);
                                    AddItem(id,"Eric Dillon",2);
                                    AddItem(id,"Liz Castleberry",3);
                                    AddItem(id,"Chantal Booker",4);
                                    AddItem(id,"Dash & Honey",5);
                                    AddItem(id,"Eric & Honey",6);
                                    AddItem(id,"Honey & Liz",7);
                                    break;
            case "fp":      AddItem(id,"Francesca Day",0);
                                    AddItem(id,"Dallie Beaudine",1);
                                    AddItem(id,"Ted Baudine",2);
                                    AddItem(id,"Skeet Cooper",3);
                                    AddItem(id,"Holly Grace Baudine",4);
                                    AddItem(id,"Dallie & Francesca",5);
                                    AddItem(id,"Dallie & Skeet",6);
                                    AddItem(id,"Dallie & Holly Grace",7);
                                    AddItem(id,"Skeet & Francesca",8);
                                    break;
            case "kaa":      AddItem(id,"Daisy Deveraux",0);
                                    AddItem(id,"Alex Markov",1);
                                    AddItem(id,"Heather Pepper",2);
                                    AddItem(id,"Sheba Quest",3);
                                    AddItem(id,"Max Petrov",4);
                                    AddItem(id,"Brady Pepper",5);
                                    AddItem(id,"Alex & Daisy",6);
                                    break;
            case "ihtby":AddItem(id,"Phoebe Sommerville",0);
                                    AddItem(id,"Dan Calebow",1);
                                    AddItem(id,"Molly Sommerville",2);
                                    AddItem(id,"Ron McDermit",3);
                                    AddItem(id,"Bobby Tom Denton",4);
                                    AddItem(id,"Viktor Szabo",5);
                                    AddItem(id,"Dan & Phoebe",6);
                                    AddItem(id,"Dan & Ron",7);
                                    AddItem(id,"Phoebe & Ron",8);
                                    break;
            case "ht":      AddItem(id,"Bobby Tom Denton",0);
                                    AddItem(id,"Gracie Snow",1);
                                    AddItem(id,"Suzy Denton",2);
                                    AddItem(id,"Way Sawyer",3);
                                    AddItem(id,"Bobby Tom & Gracie Snow",4);
                                    AddItem(id,"Way Sawyer & Suzy Denton",5);
                                    break;
            case "nbbm":AddItem(id,"Jane Darlington",0);
                                    AddItem(id,"Cal Bonner",1);
                                    AddItem(id,"Annie Glide",2);
                                    AddItem(id,"Ethan Bonner",3);
                                    AddItem(id,"Kevin Tucker",4);
                                    AddItem(id,"Lynn Bonner ",5);
                                    AddItem(id,"Jim Bonner",6);
                                    AddItem(id,"Jodie Pulanski",7);
                                    AddItem(id,"Cal & Jane",8);
                                    AddItem(id,"Kevin & Jane",9);
                                    break;
            case "dald":AddItem(id,"Rachel Stone",0);
                                    AddItem(id,"Gabe Bonner",1);
                                    AddItem(id,"Edward Stone",2);
                                    AddItem(id,"Kristy Brown",3);
                                    AddItem(id,"Ethan Bonner",4);
                                    AddItem(id,"Jane Darlington ",5);
                                    AddItem(id,"Cal Bonner",6);
                                    AddItem(id,"Gabe & Rachel",7);
                                    AddItem(id,"Ethan & Kristy",8);
                                    break;
            case "lbg":      AddItem(id,"Lady Emma Wells-Finch ",0);
                                    AddItem(id,"Kenny Traveler",1);
                                    AddItem(id,"Torie Traveller  ",2);
                                    AddItem(id,"Ted Baudine ",3);
                                    AddItem(id,"Dexter O'Conner",4);
                                    AddItem(id,"Shelby Traveller",5);
                                    AddItem(id,"Warren Traveller",6);
                                    AddItem(id,"Hugh Duke of Beddington",7);
                                    AddItem(id,"Kenny & Emma",8);
                                    break;
            case "fl":      AddItem(id,"Nealy Litchfield Case",0);
                                    AddItem(id,"Mat Jorik",1);
                                    AddItem(id,"Lucy Jorik",2);
                                    AddItem(id,"Bertis Wayne",3);
                                    AddItem(id,"Charlie Wayne",4);
                                    AddItem(id,"Jason Williams",5);
                                    AddItem(id,"Toni DeLuca",6);
                                    AddItem(id,"Mat & Nealy",7);
                                    AddItem(id,"Mat & Lucy",8);
                                    break;
            default:            break;
      }
}

// End -->
</script>


I really would appreciate you help, cause I totally stuck right now.

Thanks, Nina

[+][-]06/30/00 04:27 AM, ID: 3136659Accepted Solution

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

About this solution

Zone: JavaScript
Tags: combobox
Sign Up Now!
Solution Provided By: CJ_S
Participating Experts: 2
Solution Grade: A
 
[+][-]06/30/00 03:20 AM, ID: 3136169Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06/30/00 04:33 AM, ID: 3136725Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06/30/00 04:40 AM, ID: 3136761Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06/30/00 04:40 AM, ID: 3136762Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06/30/00 04:43 AM, ID: 3136775Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091111-EE-VQP-92