[Javascript] js and css display: none

Paul Novitski paul at dandemutande.org
Sun Mar 28 20:44:04 CST 2004


Yes, removing an object from display does not remove it from the document 
object hierarchy.  This is easy to demonstrate:

=========================================
<html>
<head>
<script language="Javascript">
function ListLinks(){
         var aLinks = document.getElementsByTagName("A");
         for (var i=0; i < aLinks.length; i++)
         {
                 alert("Link " + i + ": " + aLinks[i].name);
         }
}
</script>
</head>
<body onLoad="ListLinks()">

<a name="VisibleLink" href="#">The visible link</a>

<a name="InvisibleLink" href="#" style="display: none">The invisible link</a>

</body>
</html>
=========================================

Paul



At 05:50 PM 3/28/2004, Ira S. Mark wrote:
>List: I am having trouble with an onload script. (And what else is new?) 
>Have a question which I assume is "yes." but want to be sure: if a link is 
>in a block of code that is display: none, it still part of the 
>document.links array, no? Display removes code from presentation, but not 
>from the document tree(?). Thanks, Ira





More information about the Javascript mailing list