aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes determining if element is hidden Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "determining if element is hidden" Watch "determining if element is hidden" New topic
Author

determining if element is hidden

Sanjiv Jivan
Ranch Hand

Joined: Nov 03, 2005
Posts: 52
I have a select box within a table and it has a td which is styled to be hidden. As a result, the contents of the td are also hidden. When I do an select element iteration the select elements style.visible property does not provide any info on whether the element is visible on the page or not (i'm assuming the default is inherit). Is there an easy way of determining this other than navigating thought all parents and testing the visible property?

Thanks,
Sanjiv
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
I do not have time to code it, but it is similiar to this: http://radio.javaranch.com/pascarello/2005/01/09/1105293729000.html

Eric
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
or this might work:



var test = getElementStyle("id", "visibility", "visibility");

Eric
Sanjiv Jivan
Ranch Hand

Joined: Nov 03, 2005
Posts: 52
Unfortunately the above code isn't doing what I need.

elem.currentStyle evaluates to true in IE but elem.currentStyle["visible"] returns the String "inherit".

Sanjiv
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
visible is the value, not the style attribute name, it is visibility.

I still do not have time to test it, thought i would point out. If computed style does not work, than you are going to have to loop through the parents checking the visible state like I do to find the position in that link.

Eric
Sanjiv Jivan
Ranch Hand

Joined: Nov 03, 2005
Posts: 52
I'm sorry, that was a typo in my previous post. I did pass 'visibility' and not 'visible', and the function returned "inherit".

Sanjiv
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: determining if element is hidden