P
PaulB
Good Morning everybody,
I'm trying to adapt a tutorial script that will handle the behaviour of an
"Expanding/Contracting" site-navigation menu. The code that seems to
handle the expansion and contraction follows at the bottom of my
message here.
This following line is a big part of my hang-up:
document.getElementById('m1').style.display='none';
Question #1:
My "assumption" is that this statement line will "Contract" the menu-chain
that is named by 'm1' and the action word is 'none'.
My other 'assumption' is that the other statement line would " Expand" the
named menu-chain and the action word is 'block'.
That doesn't make sense but really, what do I know?
Am I correct in my assumptions?
Question #2: ( This is my biggie )
At the end of the day, I want the menu.shtml page to open with
this menu in a fully contracted state. Display only the major
category headings. I took all of the document.getElementById
statements and placed them in a function called CloseAll(), like this:
function CloseAll()
{
document.getElementById('m1').style.display='none';
document.getElementById('m2').... // did this for each menu-chain
}
Placed this tag in the menu.shtml
<BODY onLoad="CloseAll()">
but...
When I load the page... nothing displays... NADA, ZILCH.
If I remove the onLoad part, he page displays, but the
menu is FULLY expanded.
Clearly, I am working this code wrong, can someone please help
me sort it out? I've been kicking this thing around for so long that
I barely remember to eat.
Many thanks
-Paul-
[ All of this in now located in the "JS" file ]
document.getElementById('m1').style.display='none';
document.getElementById('m2').style.display='none';
document.getElementById('m3').style.display='none';
document.getElementById('m4').style.display='none';
document.getElementById('m5').style.display='none';
document.getElementById('m6').style.display='none';
document.getElementById('m7').style.display='none';
document.getElementById('m8').style.display='none';
document.getElementById('m9').style.display='none';
var Ary=new Array();
function toggle(list){
var listElement=document.getElementById(list);
for (i=0;i<Ary.length;i++){
if (Ary!=listElement){
Ary.style.display="none";
}
}
if (listElement.style.display=="none"){
listElement.style.display="block";
}
else {
listElement.style.display="none";
}
if (!listElement.dis){
listElement.dis=1;
Ary[Ary.length]=listElement;
}
}
I'm trying to adapt a tutorial script that will handle the behaviour of an
"Expanding/Contracting" site-navigation menu. The code that seems to
handle the expansion and contraction follows at the bottom of my
message here.
This following line is a big part of my hang-up:
document.getElementById('m1').style.display='none';
Question #1:
My "assumption" is that this statement line will "Contract" the menu-chain
that is named by 'm1' and the action word is 'none'.
My other 'assumption' is that the other statement line would " Expand" the
named menu-chain and the action word is 'block'.
That doesn't make sense but really, what do I know?
Am I correct in my assumptions?
Question #2: ( This is my biggie )
At the end of the day, I want the menu.shtml page to open with
this menu in a fully contracted state. Display only the major
category headings. I took all of the document.getElementById
statements and placed them in a function called CloseAll(), like this:
function CloseAll()
{
document.getElementById('m1').style.display='none';
document.getElementById('m2').... // did this for each menu-chain
}
Placed this tag in the menu.shtml
<BODY onLoad="CloseAll()">
but...
When I load the page... nothing displays... NADA, ZILCH.
If I remove the onLoad part, he page displays, but the
menu is FULLY expanded.
Clearly, I am working this code wrong, can someone please help
me sort it out? I've been kicking this thing around for so long that
I barely remember to eat.
Many thanks
-Paul-
[ All of this in now located in the "JS" file ]
document.getElementById('m1').style.display='none';
document.getElementById('m2').style.display='none';
document.getElementById('m3').style.display='none';
document.getElementById('m4').style.display='none';
document.getElementById('m5').style.display='none';
document.getElementById('m6').style.display='none';
document.getElementById('m7').style.display='none';
document.getElementById('m8').style.display='none';
document.getElementById('m9').style.display='none';
var Ary=new Array();
function toggle(list){
var listElement=document.getElementById(list);
for (i=0;i<Ary.length;i++){
if (Ary!=listElement){
Ary.style.display="none";
}
}
if (listElement.style.display=="none"){
listElement.style.display="block";
}
else {
listElement.style.display="none";
}
if (!listElement.dis){
listElement.dis=1;
Ary[Ary.length]=listElement;
}
}