Article ID: 178485
Article Last Modified on 12/1/2000
<body onclick="dynOutline()" onLoad="CollapseAll()">
<script LANGUAGE="JavaScript">
<!--
/* name the function so you have something you can call it with later
make it so it accepts an input argument */
function isCollapsible(rElem)
{
/* use the input argument to find the tagname, pass that to the variable
"tag" */
tag = rElem.tagName;
/* analyze the tagname and if it is a list or a table return true */
if ("UL" == tag || "OL" == tag || "TABLE" == tag)
return true;
/* otherwise return false */
return false;
}
/* name the function so it can be called later */
function CollapseAll()
{
/* create a variable ms which searches the browser version looking for
the letters MSIE */
var ms = navigator.appVersion.indexOf("MSIE");
/* create a variable ie4 which is only TRUE if ms > 0 ( MSIE was in the
browser version) and the 5th through 6th characters of the browser version
were the number 4 or higher */
ie4 = (ms>0) && (parseInt(navigator.appVersion.substring(ms+5, ms+6)) >=
4);
/* if ie4 is not true then exit the function */
if(!ie4)
return;
/* create two variables, one iElem to act as a counter, and the second
lDocLength that will equal the number of HTML tags in the entire document
*/
var iElem = 0, lDocLength = document.all.length;
/* use the two variables you created above to start a loop from 0 that
loops as long as iElem number is less than the number of tags in the
document and which adds 1 to the iElem counter each successful loop */
for (iElem = 0; iElem < lDocLength; iElem++)
{
/* create a new variable to hold the current tag*/
var rElem = document.all[iElem];
/* Use the DHTML method getAttribute. If the tag does not have the
attribute of not having a dynamic outline (if it does have a dynamic
outline attribute) and it is collapsible (a list or a table ) then... */
if (null != rElem.getAttribute("dynamicoutline", false) &&
isCollapsible(rElem))
{
/* create a new variable that checks the tag immediately after the
iLem tag, incrementing the iElem counter at the same time */
var rInnerElem = document.all[++iElem];
/* create a new loop that runs as long as the current tag is before
the last tag in the document and contained within the list or table */
for (; iElem < lDocLength && containedIn(rInnerElem, rElem);
/* move on to the next tag within the document */
rInnerElem = document.all[++iElem])
{
/* find out if the current item is a list or table */
if (isCollapsible(rInnerElem))
{
/* set up a variable to hold the parent element ( a DHTML feature
ithin IE) of the current tag */
var rCtrl = rInnerElem.parentElement;
/* as long as the parent element is not collabsible */
while (rCtrl && !isCollapsible(rCtrl))
/* evaluate the parent element of the parent element */
rCtrl = rCtrl.parentElement;
/* if the parent element is still valid and is within the list or
table then ...*/
if (rCtrl && rCtrl == rElem)
/* the tag you found at the beginning of this loop (the one
immediately after the tag which had a dynamic outline applied to it) will
not be displayed when the page is first loaded. */
rInnerElem.style.display="none";
}
}
}
}
}
//-->
</script>
"Outlines" (without the quotation marks)
Additional query words: Outline collapse collapsible collapsing cursor
Keywords: kbhowto KB178485