I have a problem with some javascript code.
I am trying to toggle display between two tables upon change of a select box ( to alternate between search forms)
eg. one called searchTableUS (displayed when USA is selected) and searchTableCA when (displayed when canada is selected)
Expand|Select|Wrap|Line Numbers
- <table id="searchTableUS">
- <tr>
- <td>
- <label class="required">Check-in:</label></td>
- <td id="checkIn">
- <select name="check-inMonthYear">
- <option value="10">Jan 2006</option>
- </select>
- <select name="check-inDay">
- <option value="10">Tue 10</option>
- </select>
- </td>
- </tr>
- </table>
- <table id="searchTableCA">
- <tr>
- <td>
- <label class="required">Check-in:</label></td>
- <td id="checkIn">
- <select name="check-inMonthYear">
- <option value="10">Jan 2006</option>
- </select>
- <select name="check-inDay">
- <option value="10">Tue 10</option>
- </select>
- </td>
- </tr>
- </table>
Expand|Select|Wrap|Line Numbers
- table.showMe,table.showMe select{
- display:block;
- }
- table.hideMe,table.hideMe select{
- display:none;
- }
Expand|Select|Wrap|Line Numbers
- function swapSimpleSearch(obj){
- var selectedCountry = obj.options[obj.selectedIndex].value; //get selection
- if (selectedCountry == "CA"){
- document.getElementById("searchTableUS").className = "hideMe";
- document.getElementById("searchTableCA").className = "showMe";
- }
- else{
- document.getElementById("searchTableCA").className = "hideMe";
- document.getElementById("searchTableUS").className = "showMe";
- }
- }
I tried adding nowrap to the td and white-space in CSS but both don't work.
Any ideas??
Thanks in advance,
Lisa