[Javascript] See if item is hidden...
Paul Novitski
paul at novitskisoftware.com
Tue Jun 22 13:08:33 CDT 2004
At 10:50 AM 6/22/2004, jsWalter wrote:
>Anyone have any idea how I can discover if a page item is hidden if it
>is a child of some other element?
...
> DIV a
> SPAN a1
> P a11
> P a12
> SPAN a2
> P a21
> P a22
...
>Now, the user turns "off" DIV 'a' and everything it has disappears.
>
>Say I want to insert some text in 'Pa21', but I need to know if it is
>showing or not.
>
>How can I know if 'Pa21' is "showing"?
Walter,
It depends on what mechanism you're using to hide the div. Parsing the
stylesheet is hard but possible (see http://dean.edwards.name/IE7/); much
easier would be to set the inline style or the class name of the
grandparent DIV.
If oP is your P tag, oP.parentElement.parentElement would be the containing
DIV, and oP.parentElement.parentElement.style.visibility or
oP.parentElement.parentElement.style.display or
oP.parentElement.parentElement.className would likely contain the
information you need.
Paul
More information about the Javascript
mailing list