PDA

View Full Version : Help with "Menu (FileTree) Script"



CyberScout
10-16-2002, 10:15 PM
I am currently working on this site: http://www2.hfs.psu.edu/TravelTest/

If you click on the button Program Information button you will see I am calling Menu1. With the script I am currently using I am can the image "closed.gif" into "open.gif" ... does anyone know how to add on to the script so I can call up several different images?

Namely, if I wanted to also change the "Program Information" button to a secondary image when they click it and change it back when they click it again, how could I go about doing that?

Thanks in advance
Ryan

adios
10-17-2002, 04:40 AM
Nice little menu.

Doesn't it already do that? :confused:

CyberScout
10-17-2002, 01:39 PM
No, currently it only changes the images marked by (open.src="open.gif") and (closed.src ="closed.gif")

The code looks something like this:

</script>

<script language="javascript">
<!--
var Open = ""
var Closed = ""

function preload(){
if(document.images){
Open = new Image(16,13)
Closed = new Image(16,13)
Open.src = "open.gif"
Closed.src = "closed.gif"
}}


function showhide(what,what2){
if (what.style.display=='none'){
what.style.display='';
what2.src=Open.src
}
else{
what.style.display='none'
what2.src=Closed.src
}
}
-->
</script>

Then the area that activates the dropdown is marked like this:
<span id="menu1" onClick="showhide(menu1outline,menu1sign)" style="cursor:hand">

The image that I change is marked with this:
<img id="menu1sign" src="closed.gif" width="31" height="17">

and finally, the area that dropsdown is marked with this:
<span id="menu1outline" style="display:'none'">

That is all of the actually working code other then adding a preload to the body tag. In this you can see it only changes ONE image, but displays anything I like under said image. My goal is to use the code to change several images at once.

Maybe adding more something.src = "something" .... I'm not sure. That is what I am asking. I have tried a couple different things, but nothing seems to work. Any help would be greatly appreciated.

-Ryan

kumghi
12-12-2003, 05:58 PM
Is there a way that you can expand all the submenu's at once?

CyberScout
12-12-2003, 06:05 PM
Hmm ... I've never tried that, but I'm sure if you make a button that is marked with the same code, but tells it to open all menus it would do it.

Like: <span id="menu1" onClick="showhide(menu1outline,menu2outline,menu3outline,menu4outline,menu5outline)" style="cursor:hand">

That is saying you have 5 menus and once you like on the button that span id is attached to, then it would open all 5.