Put results from displayed in rows or columns

Hi i have the a drop down list that depending on the user selection display the list of results
for example if (select color) display (red, blue, pink)
if select car display(ford,bentley,ferrari) and so on
but now i am trying to put the result in a table each element to their own or column.
this my code can easy be run on w3school site
can someone help me please
thanks in advance

<HTML>
<HEAD>
<SCRIPT TYPE="TEXT/JAVASCRIPT">
function setup(ans) {
  lit = ''
  if (ans == 'color') {

    lit = lit + '<br/>blue<br/>'
    lit = lit + '<br/>red<br/>'
    lit = lit + '<br/>green<br/>'
    lit = lit + '<br/>pink<br/>'
    lit = lit + '<br/>yellow<br/>'
  }
  if (ans == 'number') {
    lit = lit + '<br/>one<br/>'
    lit = lit + '<br/>two<br/>'
    lit = lit + '<br/>three<br/>'
    lit = lit + '<br/>four<br/>'
    lit = lit + '<br/>five<br/>'

  }


 if (ans == 'car') {
    lit = lit + '<br/>ferrari<br/>'  
    lit = lit + '<br/>bentley<br/>'
    lit = lit + '<br/>ford<br/>'
    lit = lit + '<br/>mustang<br/>'

  }
  document.getElementById('rep').innerHTML=lit
}
</SCRIPT>
</HEAD>
<BODY>

<FORM ACTION="#" NAME="quest">
<SELECT NAME="q1" ONCHANGE="setup(document.quest.q1.value)">
<OPTION VALUE="">- Please select -</OPTION>
<OPTION VALUE="color">Color</OPTION>
<OPTION VALUE="number">Number</OPTION>
<OPTION VALUE="cars">Cars</OPTION>
</SELECT>

<SPAN ID="rep"></SPAN>

</FORM>

</BODY>
</HTML>

Hope, this helps.


<HTML>
<HEAD>
<SCRIPT TYPE="TEXT/JAVASCRIPT">
function setup(ans) {
  lit = ''
  if (ans == 'color') {

    lit = lit + '<td>blue</td>'
    lit = lit + '<td>red</td>'
    lit = lit + '<td>green</td>'
    lit = lit + '<td>pink</td>'
    lit = lit + '<td>yellow</td>'
  }
  if (ans == 'number') {
    lit = lit + '<td>one</td>'
    lit = lit + '<td>two</td>'
    lit = lit + '<td>three</td>'
    lit = lit + '<td>four</td>'
    lit = lit + '<td>five</td>'

  }


   if (ans == 'car') {
    lit = lit + '<td>ferrari</td>'  
    lit = lit + '<td>bentley</td>'
    lit = lit + '<td>ford</td>'
    lit = lit + '<td>mustang</td>'
  }
  document.getElementById('rep').innerHTML=lit
}
</SCRIPT>
</HEAD>
<BODY>

<FORM ACTION="#" NAME="quest">
<SELECT NAME="q1" ONCHANGE="setup(document.quest.q1.value)">
<OPTION VALUE="">- Please select -</OPTION>
<OPTION VALUE="color">Color</OPTION>
<OPTION VALUE="number">Number</OPTION>
<OPTION VALUE="cars">Cars</OPTION>
</SELECT>

<table border=1>
<tr id="rep">
</tr>
</table>

</FORM>

</BODY>
</HTML>

perfect senidaljeet thank you very much

Hi again i’ve got two faults with this form 1 when i put the form on my page and try to select the very first option color it doesnt open it only opens when select the other ones and then go bk to the first one. fi you refresh and try to select the color one it wont wont you have to select the other one before you can select the color is just oding on my pc or is it doing on somenone else pc help please

2nd problem tr not showing on chrome why?
this how my table looking now

<SCRIPT TYPE=“TEXT/JAVASCRIPT”>
function setup(ans) {
lit = ‘’
if (ans == ‘color’) {

lit = lit + '&lt;tr bgcolor="orange"&gt;&lt;td&gt;blue sdrtgrtgr&lt;/td&gt;&lt;/tr&gt;'
lit = lit + '&lt;tr bgcolor="orange"&gt;&lt;td&gt;red&lt;/td&gt;&lt;/tr&gt;'
lit = lit + '&lt;tr bgcolor="#FF0000"&gt;&lt;td&gt;green&lt;/td&gt;&lt;/tr&gt;'
lit = lit + '&lt;tr bgcolor="#FF0000"&gt;&lt;td&gt;pink&lt;/td&gt;&lt;/tr&gt;'
lit = lit + '&lt;tr bgcolor="#FF0000"&gt;&lt;td&gt;yellow&lt;/td&gt;&lt;/tr&gt;'

}
if (ans == ‘number’) {
lit = lit + ‘<tr bgcolor=“orange”><td>one</td></tr>’
lit = lit + ‘<tr><td>two</td></tr>’
lit = lit + ‘<tr><td>three</td></tr>’
lit = lit + ‘<tr><td>four</td></tr>’
lit = lit + ‘<tr><td>five</td></tr>’

}

if (ans == ‘cars’) {
lit= lit + ‘<tr><td>ferrari</td></tr>’
lit= lit + ‘<tr><td>bentley</td></tr>’
lit= lit + ‘<tr><td>ford</td></tr>’
lit= lit + ‘<tr><td>mustang</td></tr>’
}
document.getElementById(‘rep’).innerHTML=lit
}
</SCRIPT>

FORM ACTION=“#” NAME=“quest”>
<SELECT NAME=“q1” ONCHANGE=“setup(document.quest.q1.value)”>
<OPTION VALUE=“”>- Please select -</OPTION>
<OPTION VALUE=“color”>Color</OPTION>
<OPTION VALUE=“number”>Number</OPTION>
<OPTION VALUE=“cars”>Cars</OPTION>
</SELECT>

<table >
<tr id=“rep”>

</tr>
</table>
</FORM>

Hi again i’m having the following issue on that call function
when i try to insert
a link to call a jw video

 lit = lit + '<a href="#" onClick="jwplayer().load({'file': 'hofbell30732_SD.mp4', 'hd.file': 'videos/film.mp4'})">    javascript video with hd file not working</a>'

the drop down function stops working i suspect it might be either cz of the semicolons or something but i’m not sure can someone help me out please?

ok i manage to get the drop down list to display the results again as it seems had to make single quotes(‘) into double quotes (") inside the curly brackets but now the link doesnt work how can i allow single quotes or make the link work again
this how the kink works outside the function with single (’)

<a href="#" onClick="jwplayer().load({'file': 'hofbell30732_SD.mp4', 'hd.file': 'videos/film.mp4'})'>    javascript video with hd file not working</a>

now inside the function had to change the quotes to double quotes inside the curly brackets

<a href="#" onClick="jwplayer().load({'file': 'hofbell30732_SD.mp4', 'hd.file': 'videos/film.mp4'})'>    javascript video with hd file not working</a>

but the link doesnt work with double quotes
how can i get it to work insid ethe function

but the link doesnt work with double quotes
how can i get it to work insid ethe function

jw player has its own set of functions and parameters.Need to know, how they are set.could you help with its documentation ?