home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Windows News 2006 October
/
wn148cd2.iso
/
Windows
/
S'informer
/
Maxthon
/
Plugin
/
SearchBar
/
DynOutline.js
next >
Wrap
Text File
|
2004-11-13
|
3KB
|
110 lines
<!--
function fInitOutline(vType) {
// Initializing function fo collapse, expand, or selectively expand outline
// Arguments:
// vType : allowed values are "expand", "collapse", or "initexpand"
// "initexpand" collapses the entire outline EXCEPT for UL, OL, and
// table elements that have an attribute of "initexpanded"
var vListTags = ["UL", "OL", "TABLE"];
for(j=0;j<vListTags.length;j++) {
var vTagName=vListTags[j];
vCollapseTag = document.all.tags(vTagName);
for(i=0; i<vCollapseTag.length; i++) {
if (fDynOutlineEnabled(vCollapseTag[i].parentElement)) {
switch (vType) {
case "expand" :
vCollapseTag[i].style.display="block";
break;
case "collapse" :
vCollapseTag[i].style.display="none";
break;
case "initexpand" :
if (vCollapseTag[i].getAttribute("initexpanded", false) != null) {
vCollapseTag[i].style.display="block";
} else {
vCollapseTag[i].style.display="none";
}
break;
}
}
}
}
}
function fDynOutline() {
var vSource = event.srcElement;
vSource = fGetControlTag(vSource);
if (null == vSource) {
return;
}
if (!fDynOutlineEnabled(vSource)) {
return;
}
var vIndex = vSource.sourceIndex+1;
while (vIndex < document.all.length && fContainedIn(document.all[vIndex], vSource)) {
var SourceTemp = document.all[vIndex];
vTag = SourceTemp.tagName;
if (vTag == "UL" || vTag == "OL" || vTag == "TABLE") {
SourceTemp.style.display = (SourceTemp.style.display == "none" ? "block" : "none");
}
vIndex++;
}
}
function fDynOutlineEnabled(argSource) {
// looks for flag in HTML code;
// permissible values are "noMyDynamicOutline" and "MyDynamicOutline"
while (argSource.tagName != "BODY") {
vTable = (argSource.tagName == "TABLE");
if (vTable && argSource.getAttribute("border", false) != "0") {
return false;
}
if (argSource.tagName == "OL" || argSource.tagName == "UL" || vTable) {
if (argSource.getAttribute("noMyDynamicOutline", false) != null) {
return false;
}
if (argSource.getAttribute("MyDynamicOutline", false) != null) {
return true;
}
}
argSource = argSource.parentElement;
}
return false
}
function fGetControlTag(argSource) {
vTRok = false;
while (argSource.tagName != "HTML") {
if (argSource.tagName == "IMG" || argSource.tagName == "FONT" ||
argSource.tagName == "A" || argSource.tagName == "TD") {
vTRok = true;
}
if (argSource.tagName == "LI") {
return argSource;
}
if (argSource.tagName == "TR") {
if (vTRok) {
return argSource;
} else {
return null;
}
}
argSource = argSource.parentElement;
}
return null;
}
function fContainedIn(argSource, argDestination) {
if (argSource.tagName == "!") {
return true;
}
argSource = fGetControlTag(argSource);
if (argSource == argDestination) {
return true;
} else {
return false;
}
}
//-->