• 0

Anyone here know JavaScript?


Question

I was wondering if there was anyone out there who could help me with a JavaScript dynamic menu thing I'm trying to complete before December... you can view it at http://futureworld.animefringe.com/newaf/index.html, and clicking the green bars expands and collapses the menus.

My problem is the little white arrows. The script can't tell one from the other, so when you expand one menu, the arrow turns on the other one and so forth. I know I should add a variable or something so it knows which is which, but I don't know how. So I would appreciate some help. Send me an e-mail or just reply here. Thanks! :D

Link to comment
https://www.neowin.net/forum/topic/4721-anyone-here-know-javascript/
Share on other sites

2 answers to this question

Recommended Posts

  • 0

<pre>

function imgLoad() {



    if (document.images) {

        img1 = new Image(); img1.src = "arrow-expand-ani.gif";

        img2 = new Image(); img2.src = "arrow-collapse-ani.gif"; }

 }



function toggle(number){var theitem = event.srcElement;

var menucontent = theitem.parentElement.parentElement.rows[1];

var collapsed = ((menucontent.style.display == "none") ? true : false);

var myArrow = eval("arrow" + number);

if (collapsed == true) menucontent.style.display = "";

else menucontent.style.display = "none";

if (collapsed == true) document.images[myArrow].src = 'arrow-expand-ani.gif';

else document.images[myArrow].src = 'arrow-collapse-ani.gif';



 }</pre>

The above code should work... sorry I don't have time to test it, I am in a bit of a hurry as I have to run to work... if you have any problems, email me ([email protected]) sending me all files including the images... and I will take a closer look at it...

Hope this helps.

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.