File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Soft Skills: The software developer's life manual this week in the Jobs Discussion forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Issue with style display property

 
Rob Hunter
Ranch Hand
Posts: 832
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have 3 tr tags (rows) in my table. Each tr tag is labelled 1 thru 3 (so their id property is set to Row1, Row2, and Row3). When the page loads, the first tr tag is displayed (default) and the second and third tr tags have an in-line stylesheet attached (i.e. style="display: none;"). I have a javascript function that accepts a number from 1 to 3 and, depending on the number selected that line is displayed and the others hidden. Here's the small bit of code used in this :


Here is the source code of the page showing the 3 rows in the table :



Any help would be appreciated. Thanks.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64171
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What's the problem?
 
Rob Hunter
Ranch Hand
Posts: 832
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Lol. Got caught up with posting the info. Can't you read minds? When I click a button that is to display the second or third row the content from the row gets pushed together. So instead of the content being displayed in the cells spaced apart it's as though the <td> tags are completely ignored. Each td tag should be 25% of the table and displayed fine when initially displayed.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64171
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You probably don't want "inline". Try letting the element take on its natural state by specifying "".

If that fails, it should probably be "block".

(Hint, hint: personally I'd be using jQuery's show() and hide() functions that always figure out how to do it right.)
 
Rob Hunter
Ranch Hand
Posts: 832
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Bear. Worked great! Just fooling around with some code, when doing that I'd rather take the path not traveled when learning.
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I really do not htink you want block either since certain browsers would want "table-row".

The easiest way to show the item with display is to set it to ""

myObj.display = "";


When you do that, the default for the element is selected.

Eric
 
Rob Hunter
Ranch Hand
Posts: 832
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks guys! Setting it to "" worked great.
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic