Hi, thanks for your investigation :)
I've solved my problems like this:
    -cancelling parent event: I use "event.cancelBubble=true"
    -updating the "onclick" event: I've cheated and don't use this way, the called function eval the the style.display and automatically swap it
 
here is the new sourcecode for those that are interested
 
Thanks again Ben, your notations like event.srcElement and elm.sourceIndex have render me a little less newbie :)
just a remark: these notations are not DOM compliant for those wich browser compatibility matter
Does IE on Mac is working right with DOM?
 
Gauthier
 
----- Original Message -----
Sent: Tuesday, May 28, 2002 9:57 PM
Subject: RE: Witango-Talk: [OT] javascript newbie need a hand

Hi,

 

Found that the main <UL> is the one receiving the onClick event so I changed it to use a single onclick call and then extract the document.all index and go from there. (see attached).

I have changed it so that it just deletes the li clicked

 

I think the speed at which this is all changing; makes us all newbie�s ;-)

Ben Johansen - http://www.pcforge.com
Authorized Witango Reseller
http://www.pcforge.com/WitangoGoodies.htm 
Latest downloads & List Archives @
http://www.witango.ws

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] On Behalf Of [Gauthier]
Sent: Sunday, May 26, 2002 11:27 PM
To: Multiple recipients of list witango-talk
Subject: Witango-Talk: [OT] javascript newbie need a hand

 

Hi,

 

I'm just starting experimentation with javascript, here is an attached html file to illustrate my post, the idea is to have a simple DOM compliant manipulable menu base on <ul> and <li> tags.

I've defined 2 function:

    hideChilds(elm) wich take an elements and hide all the child tags elements

    showChilds(elm) that does the oposite of hideChilds

 

Currently 2 problems occurs:

    -I'm unable to replace accurately the onclick event of the 'elm' parameters of my functions

    -clicking on a child <li> fire onclick of parent <li>

 

so two questions:

    -how can I set the elm.onclick property (should I call it a property???) to call the oposite function?

    -how can I avoid onclick event of parents elements (try clicking on a submenu item)

 

I've added an alert at the end of each functions as checking purpose

I've commented my last instruction that reaffect the elm.onclick property

 

Thanks alot for any hint

 

Gauthier

Title:

Reply via email to