From dave@davesdomain.org.uk Thu Feb 18 19:52:09 2010 From: David Boucher To: staffslug@staffslug.org.uk Subject: Re: [Staffslug] Javascript Problem Date: Thu, 18 Feb 2010 19:52:07 +0000 Message-ID: <4B7D9A67.4040408@davesdomain.org.uk> In-Reply-To: 000801cab0cf$48655600$d9300200$@co.uk MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============6886769156703864402==" --===============6886769156703864402== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit walt wrote: > Thanks. And you are right. I had already used alert to check the IDs 2 or > 3 days ago and it does work its way back from say c1 back up to a1 without > any help from me. None of the languages I have used do this or at least I > have never seen it happen. > I've got this to work now, at least on Firefox anyway. The new version is below. I changed two things: 1. Calls to findChildren now pass an extra parameter, event, which is the current event object. 2. At the start of findChildren is some extra code: if (!e) var e = window.event; e.cancelBubble = true; if (e.stopPropagation) e.stopPropagation(); The first line get the current event, if one wasn't passed in (needed for IE I believe), the other two turn off event propagation using two methods to allow for browser differences. The other thing that I spotted that you might want to change is that as it stands, clicking on a "leaf" item (one with no children) collapses the parent level. Adding a onclick handler that disables event propagation, but does nothing else, would probably fix this. === SCRIPT === Menu Test This is a menu test!!


--===============6886769156703864402==--