vendredi 17 avril 2015

Radio Buttons, Store in Array and utilize switch statement [on hold]

Thank you in advance to anyone who answers this. Once the user clicks on a check box I need to store the input into an array. Within the function I created I need to utilize switch statements to determine which index to use. Furthermore, the output needs to automatically update when each of the check boxes is selected. Right now every value from each check box displays instead of each individual one how do I change that? Also each time a radio button is checked the output should update but it isn't.


Again, thank you for helping me and for your time.



var infoArray=[];

function userSelection(thisControl)
{
var userInput = document.getElementsByName('sectionR');
var userOutput= userInput.value;

switch(userInput)
{
case "sectionR":
{
switch(userOuput)
{
case "repair car":
infoArray[0]=1;
break;

case "wood work":
infoArray[0]=2;
break;

case "explore forest":
infoArray[0]=3;
//end of sub switch
}
//end of case "sectionR"
}
//end of main switch
}
var userOutput=new Array();
for(var i=0; i<userInput.length; i++)
{
userOutput.push (userInput[i].value);
}
document.getElementById("selectionTotal").innerHTML = userOutput ;
//end of userSelection()
}

Aucun commentaire:

Enregistrer un commentaire