Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


change text box to drop-down hotpotatoes

Posted on 2004-09-18
Medium Priority
Last Modified: 2008-02-01
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

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>


yet, it still needs to check the answer using the CheckAnswer2 function and turn green if it is correct, etc.
Question by:dqasem
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
LVL 36

Expert Comment

ID: 12093053
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);">


Author Comment

ID: 12093202
sorry doesn't work...
LVL 36

Accepted Solution

Zyloch earned 1600 total points
ID: 12093248
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( );
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;
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Author Comment

ID: 12093343
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
LVL 75

Expert Comment

by:Michel Plungjan
ID: 12093345
or more compatible

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

LVL 36

Assisted Solution

Zyloch earned 1600 total points
ID: 12093495
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?

Author Comment

ID: 12093794
Zyloch, what do you mean?I can change the code any way i need to, i just need to know how.
LVL 36

Expert Comment

ID: 12093804
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.

Featured Post

Build and deliver software with DevOps

A digital transformation requires faster time to market, shorter software development lifecycles, and the ability to adapt rapidly to changing customer demands. DevOps provides the solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In Part 1 ( we covered the hexagonal maze basics -- how the cells are represented in a JavaScript array and how the maze is displayed.  In this part, we'…
A while back, I ran into a situation where I was trying to use the calculated columns feature in SharePoint 2013 to do some simple math using values in two lists. Between certain data types not being accessible, and also with trying to make a one to…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question