• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 681
  • Last Modified:

change text box to drop-down hotpotatoes

hey everybody,

i have completed one version of my site and have edited some code made by software called hotpotaoes. however, i know need to change the text boxes into drop-downs while maintaining the integrity of the rest of the code.

The site is located at russian.davidqasem.com

the important stuff is at "David's Code" and a few lines after where the actual gaps are created.

as an example of what i need:

1.      &#x041D;&#x0438;&#x043A;&#x043E;&#x043B;&#x0430;&#x0439; &#x0432;&#x0447;&#x0435;&#x0440;&#x0430; &#x0432;&#x0435;&#x0441;&#x044C; &#x0434;&#x0435;&#x043D;&#x044C; &#x043D;&#x0438;&#x0447;&#x0435;&#x0433;&#x043E; &#x043D;&#x0435; <span class="GapSpan" id="GapSpan0"><input type="text" id="Gap0" onfocus="TrackFocus(0)" onblur="CheckAnswer2(this,0)" class="GapBox" size="6"></input></span>.

this span needs to become something like this

<select name="Question3" size="1"><option>MCQ #3</option><option value="progeny">progeny</option><option value="chinked">chinked</option><option value="acquaintance">acquaintance</option><option value="damnation">damnation</option><option value="stroll">stroll</option><option value="sin">sin</option><option value="organizing">organizing</option><option value="solitary">solitary</option><option value="gambling">gambling</option><option value="fall">fall</option></select>

(JUST SOMETHING I FOUND ON A SITE)

yet, it still needs to check the answer using the CheckAnswer2 function and turn green if it is correct, etc.
0
dqasem
Asked:
dqasem
  • 4
  • 3
2 Solutions
 
ZylochCommented:
Hi dqasem,

Try using what you have with the select tags. Only, add class="GapBox" to it, like this:

<select name="Question3" size="1" class="GapBox" onchange="CheckAnswer2(this,0);" onfocus="TrackFocus(0);">

Regards,
Zyloch
0
 
dqasemAuthor Commented:
sorry doesn't work...
0
 
ZylochCommented:
You'd also need to change some stuff in your functions. For example, in your CheckAnswer2 function, change this:

var strAnswer = document.getElementById('Gap' + i).value.toLowerCase( );
to
var strAnswer = document.getElementById('Gap' + i).options[document.getElementById('Gap'+i).selectedIndex].value.toLowerCase( );


and in GetGapValue, you'd want:

RetVal = document.getElementById('Gap' + GNum).options[document.getElementById('Gap'+GNum).selectedIndex].value;
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
dqasemAuthor Commented:
sorry, it doesn't work...i get a bunch of errors, the old text box stays around and ther areno color changes etc.if you would be willing to get the file to work and post it or email to me that would work best because right now, i am very lost
0
 
Michel PlungjanIT ExpertCommented:
or more compatible

sel = document.forms[0].elements['Gap' + i];
var strAnswer = sel.options[sel.selectedIndex].value.toLowerCase( );

Michel
0
 
ZylochCommented:
Is it possible for you to change the code on that site so that all the textfields are changed to the drop downs you need?
0
 
dqasemAuthor Commented:
Zyloch, what do you mean?I can change the code any way i need to, i just need to know how.
0
 
ZylochCommented:
Yes, you showed the <select><option> script above. You're going to end up replacing that for every textbox there right? So in your first post, just repace the <input> tag in there with your <select> stuff.
0

Featured Post

Become an Android App Developer

Ready to kick start your career in 2018? Learn how to build an Android app in January’s Course of the Month and open the door to new opportunities.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now