View Single Post
Old 02-04-2013, 08:22 PM   PM User | #3
if_only
New to the CF scene

 
Join Date: Jan 2013
Posts: 8
Thanks: 4
Thanked 0 Times in 0 Posts
if_only is an unknown quantity at this point
Firstly .... Thank you very much for taking the time out of your day to reply - I was starting to think I was not going to get any at all! Unfortunately there are a few reasons why this is not the solution for me .....


The first and main reason is: The app has now lost all of it's functionality! In my original code this ........

Code:
document.getElementById("thebutt").onclick=function (){
 var foods={

"Food Suggestion 1 (product code in here)":{taste:"sour", temp:"cold", health:"good"},
"Food Suggestion 2 (product code in here)":{taste:"bland", temp:"warm", health:"good"},
"Food Suggestion 3 (product code in here)":{taste:"medium", temp:"hot", health:"good"},
"Food Suggestion 4 (product code in here)":{taste:"hot", temp:"burning", health:"good"},
"Food Suggestion 5 (product code in here)":{taste:"sour", temp:"cold", health:"bad"},
"Food Suggestion 6 (product code in here)":{taste:"bland", temp:"warm", health:"bad"},
"Food Suggestion 7 (product code in here)":{taste:"medium", temp:"hot", health:"bad"},
"Food Suggestion 8 (product code in here)":{taste:"hot", temp:"burning", health:"bad"},

 }

 var picks="";
 var ta=document.getElementById("taste").value;
var ty=document.getElementById("temp").value;
var h=document.getElementById("health").value;
 for (k in foods){
  var f=foods[k];
  if((ta==f.taste||ta==0)&&(ty==f.temp||ty==0)&&(h==f.health||h==0)) {
   picks+=k+"\n"
  }
 }
 document.getElementById('img').src=picks.replace(/\s/g,'')+'gif';

 var str=picks==""?"No foods meet your criteria":'Your search criteria:\n'+picks;
 document.getElementById("res").innerHTML=str;
 document.getElementById("float_res").innerHTML=str;
}
...... took the variables selected in the drop down and found the correct food type based on the 3 answers. (So something like Hot, Bland, Good would produce "Tomato Soup" as an answer).

Secondly .... Part of my problem is changing the drop down menus to radio buttons instead ....

Lastly .... I need the 1st question to disappear leaving the next and so on!


Thanks again for your help mate - you are literally the only one kind enough to stick their neck out so I very much appreciate it!
if_only is offline   Reply With Quote