473,396 Members | 1,714 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Show-hide table content wrapping

Hi All,

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
  1. <table  id="searchTableUS">
  2. <tr>
  3. <td>
  4.   <label class="required">Check-in:</label></td>
  5. <td id="checkIn">
  6.   <select name="check-inMonthYear">
  7.     <option value="10">Jan 2006</option>
  8.   </select>                            
  9.   <select name="check-inDay">
  10.     <option value="10">Tue 10</option>
  11.   </select>
  12. </td>
  13. </tr>
  14. </table>
  15.  
  16. <table  id="searchTableCA">
  17. <tr>
  18. <td>
  19.   <label class="required">Check-in:</label></td>
  20. <td id="checkIn">
  21.   <select name="check-inMonthYear">
  22.     <option value="10">Jan 2006</option>
  23.   </select>                            
  24.   <select name="check-inDay">
  25.     <option value="10">Tue 10</option>
  26.   </select>
  27. </td>
  28. </tr>
  29. </table>
CSS:

Expand|Select|Wrap|Line Numbers
  1. table.showMe,table.showMe select{
  2.     display:block;    
  3. }
  4. table.hideMe,table.hideMe select{
  5.     display:none;
  6. }
Javascript (called onChange of select box and passes the object):

Expand|Select|Wrap|Line Numbers
  1. function swapSimpleSearch(obj){
  2.  var selectedCountry = obj.options[obj.selectedIndex].value;    //get selection
  3.  if (selectedCountry == "CA"){
  4.    document.getElementById("searchTableUS").className = "hideMe";
  5.    document.getElementById("searchTableCA").className = "showMe";
  6.  }
  7.  else{
  8.    document.getElementById("searchTableCA").className = "hideMe";
  9.    document.getElementById("searchTableUS").className = "showMe";
  10.  }        
  11. }
The problem I am having is when the hidden table is displayed, the select boxes are wrapping underneath each other instead of on the same line in the <TD>. I know its not the html as when the page first loads it looks fine. Its only when you hide it and display it again. Is there a known issue with hide/showing tables and content wrapping?

I tried adding nowrap to the td and white-space in CSS but both don't work.

Any ideas??

Thanks in advance,
Lisa
May 4 '07 #1
1 2118
acoder
16,027 Expert Mod 8TB
Try giving the td width.
May 4 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Tim Williams | last post by:
I'm trying to write a simple python program to access a MySQL database. I'm having a problem with using MySQLdb to get the results of a SQL command in a cursor. Sometimes the cursor.execute works,...
77
by: nospam | last post by:
Reasons for a 3-tier achitecture for the WEB? (NOTE: I said, WEB, NOT WINDOWS. DON'T shoot your mouth off if you don't understand the difference.) I hear only one reason and that's to switch a...
13
by: | last post by:
Although this question does not belong in here, I hope someone help, as I do not know where to send it, but someone here might have come acros similar problem: Some of JPG files sitting in the...
1
by: salo | last post by:
hi at visual basic 6 i write this to the button1_cl1ck unload form1 form2.show
4
by: bnob | last post by:
In a Button clik event I have this code at the end of the event Response.Redirect("Page.aspx") But in this event I must show a message before redirect to the Page.aspx. I use to show Message...
7
by: Rudy | last post by:
Hello All! After working in the television industry, moving to a developing career has been interesting to say the least. 3 years of developing with books, and the help of you fine folks on this...
20
by: ed | last post by:
Hi I can't seem to make the Me.Show() work My code is dim dlgresult as dialogresul dlgresult=me.show( The message is : "expression does not produce a value
1
by: Paul Fairless | last post by:
Could someone please explain how I overload the Show() method of a form? Suppose I select a record from a datagrid on Form1, then I want to show the details of the selected record by opening...
6
by: Xavier PACOTTE | last post by:
Hello, I would like to add some actions to show function of a form with Visual Stuio 2005. Is it possible? Is it possible to create a new Show function which inherit of old it? Best Regards.
4
by: Gaz | last post by:
I am having a bit of a problem getting my application to work properly. RIght here is my problem... WHen my C# windows app loads up the start form, i create a new thread and show the splash...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.