I dont want the LI elements. Here is how it is setup, <div class="lista_izq"> <ul> <li><div class="text">text1</div> <div class="hidden_text">hidden1</div> </li> <li><div class="text">text2</div> <div class="hidden_text">hidden2</div> </li> </ul> </div> <div class="lista_der"> </div> I want display my message in lista_der. So that is why i use all those up(), i guess I can use 4 up and one next.
On Sep 21, 3:50 am, Kevin Porter <k...@9ballpool.co.uk> wrote: > First things first - you've got four up()s in a row, which is likely to > return you the document or window object. > > If you want the LI element you only need one up() from the div. > > regards, > > - Kev > > > > JuanDiegowrote: > > I used up() and didnt work, it is the same error. > > Here is the test page > >http://pts.raidenenergy.com/index.php?option=com_content&view=categor... > > > and this is the code. > > > function listas(){ > > $$('div.texto').each(function(s) { Event.observe(s, 'mouseover', > > reemplazarX)}); > > $$('div.texto').each(function(s) { Event.observe(s, 'mouseout', > > borrar)}); > > }; > > > function reemplazarX(){ > > var element = this; > > //var e2 =element.getOffsetParent(); > > var e2 =element.up().up().up().up(); > > //alert(e2); > > e2.childElements()[2].setStyle({ > > backgroundColor: '#020506', > > opacity: 1.0, > > borderLeft:'1px #FFF solid' > > }); > > e2.childElements()[2].innerHTML= element.next().innerHTML; > > > } > > function borrar(){ > > var element = this; > > //var e2 =element.getOffsetParent(); > > var e2 =element.up().up().up().up(); > > e2.childElements()[2].innerHTML= ""; > > e2.childElements()[2].setStyle({ > > backgroundColor: '#000', > > opacity: 0.0 > > }); > > } > > > On Sep 18, 5:27 am, david <david.brill...@gmail.com> wrote: > > >> HiJuan, > > >> IE has much trouble with table. So not surprinsing that IE doesn't > >> work as expected. > > >> -- > >> david > > >> On 17 sep, 19:10,JuanDiego<juandieg...@gmail.com> wrote: > > >>> Thanks. > >>> One more thing, I am doing this inside a joomla so those divs are > >>> inside a table inside the"content" module of joomla. When ever I use > >>> alert(e2) I thought i was getting the table, because it said something > >>> about "table element", so for some reason in internet explorer it goes > >>> directly to the body. That is what it is happening right? I am going > >>> to try with teh up() function. > > >>> Ken I am using [2] because there is some text with <p></p> that i > >>> though it wasnt important. But thanks for noticing. > > >>>Juan > > >>> On Sep 17, 6:08 am, david <david.brill...@gmail.com> wrote: > > >>>> Hi Kev, > > >>>> the getOffSetParent() return the "closest positioned ancestor", and if > >>>> not found return the body ! > >>>> That's why for some element, parent is not positionned (CSS position > >>>> property) and it return the body element. > > >>>> As you say, up() is much more appropriate in this case. > > >>>> -- > >>>> david > > >>>> On 17 sep, 10:38, Kevin Porter <k...@9ballpool.co.uk> wrote: > > >>>>> HiJuan, > > >>>>> For me, I get the error at "e2.childElements()[2].setStyle...". > >>>>> e2 at that point is the body element. Is that what you want? > >>>>> I guess you want the LI element? If so, maybe .up() would be a better > >>>>> choice than .getOffSetParent()? > >>>>> Also, you probably want to use "[1]" instead of "[2]" to reference the > >>>>> second element of the LI. (it's > >>>>> a zero-indexed array). > > >>>>> regards, > > >>>>> - Kev > > >>>>> JuanDiegowrote: > > >>>>>> Ok, so I cleaned up my code. I used "each" instead of a For loop, so > >>>>>> now it works in every Browser except IE8. I havent tested it in other > >>>>>> versions of IE. Like 6 o 7. > >>>>>> So here is the code. > > >>>>>> function listas(){ > >>>>>> $$('div.texto').each(function(s) { Event.observe(s, 'mouseover', > >>>>>> reemplazarX)}); > >>>>>> $$('div.texto').each(function(s) { Event.observe(s, 'mouseout', > >>>>>> borrar)}); > >>>>>> }; > > >>>>>> function reemplazarX(){ > >>>>>> var element = this; > >>>>>> var e2 =element.getOffsetParent(); > >>>>>> alert(e2); > >>>>>> e2.childElements()[2].setStyle({ > >>>>>> backgroundColor: '#020506', > >>>>>> opacity: 1.0, > >>>>>> borderLeft:'1px #FFF solid' > >>>>>> }); > >>>>>> e2.childElements()[2].innerHTML= element.next().innerHTML; > > >>>>>> } > >>>>>> function borrar(){ > >>>>>> var element = this; > >>>>>> var e2 =element.getOffsetParent(); > >>>>>> e2.childElements()[2].innerHTML= ""; > >>>>>> e2.childElements()[2].setStyle({ > >>>>>> backgroundColor: '#000', > >>>>>> opacity: 0.0 > >>>>>> }); > >>>>>> } > > >>>>>> I get an error on Line 14. "The object does not accept this property > >>>>>> or method" So the problem seems to be in this line var e2 > >>>>>> =element.getOffsetParent(); > >>>>>> With getOffsetParent function. > > >>>>>> This code works in opera, konqueror, safari, firefox. > > >>>>>> Thanks > > >>>>>> On Sep 17, 12:36 am,JuanDiego<juandieg...@gmail.com> wrote: > > >>>>>>> By the way i just found out that > >>>>>>> var lista_izq=$$('div.lista_izq')[i].childElements()[0].childElements > >>>>>>> (); > >>>>>>> is the problem in IE explorer. In opera works but in IE8 is a problem > > >>>>>>> On Sep 17, 12:19 am,JuanDiego<juandieg...@gmail.com> wrote: > > >>>>>>>> Hi I havent use javascript and prototype in a while so maybe i am > >>>>>>>> doing something really wrong. > >>>>>>>> So here is what I am trying to do with prototype > >>>>>>>> I have a a few places in my page with a set of to divs divs, > >>>>>>>> lista_izq > >>>>>>>> and lista_der, with a list inside list_izq > >>>>>>>> <div class="lista_izq"> > >>>>>>>> <ul> > >>>>>>>> <li><div class="text">text1</div> > >>>>>>>> <div class="hidden_text">hidden1</div> > >>>>>>>> </li> > >>>>>>>> <li><div class="text">text2</div> > >>>>>>>> <div class="hidden_text">hidden2</div> > >>>>>>>> </li> > >>>>>>>> </ul> > >>>>>>>> </div> > >>>>>>>> <div class="lista_der"> </div> > > >>>>>>>> So when ever the mouse is over the text1 or text2. The hidden text > >>>>>>>> appears on the second . > >>>>>>>> I use firefox so I did all the testing there. It worked but when i > >>>>>>>> tested on opera, IE, and konqueror it didnt. It is really anoying > >>>>>>>> tracing bugs in other browsers without firebug. Anyhow here is my > >>>>>>>> code for each node > > >>>>>>>> Event.observe(titulo, 'mouseover', function(e) { > >>>>>>>> reemplazarX(e); > >>>>>>>> }); > >>>>>>>> Event.observe(titulo, 'mouseout', function(e) { > >>>>>>>> borrar(e); > >>>>>>>> }); > > >>>>>>>> and this my functions > > >>>>>>>> function reemplazarX(e){ > >>>>>>>> alert(e); > >>>>>>>> alert(e.element); > >>>>>>>> alert(e.element()); > >>>>>>>> var element = e.element(); > >>>>>>>> alert("s"); > >>>>>>>> var e2 =element.getOffsetParent(element); > >>>>>>>> alert("t"); > >>>>>>>> //e2.childElements()[2].setStyle('backgroundColor', blue); > > >>>>>>>> alert(element); > >>>>>>>> alert("xx"); > >>>>>>>> e2.childElements()[2].setStyle({ > >>>>>>>> backgroundColor: '#020506', > >>>>>>>> opacity: 1.0, > >>>>>>>> borderLeft:'1px #FFF solid' > >>>>>>>> }); > >>>>>>>> e2.childElements()[2].innerHTML= element.next().innerHTML; > > >>>>>>>> } > > >>>>>>>> function borrar(e,lista_der){ > >>>>>>>> var element = e.element(); > >>>>>>>> var e2 =element.getOffsetParent(element); > >>>>>>>> e2.childElements()[2].innerHTML= ""; > >>>>>>>> e2.childElements()[2].setStyle({ > >>>>>>>> backgroundColor: '#000', > >>>>>>>> opacity: 0.0 > >>>>>>>> }); > > >>>>>>>> } > > >>>>>>>> I did all those "Trace" to narrow down the problem and it comes down > >>>>>>>> to e.element. In opera it returns undefine with e.element and it > >>>>>>>> dies > >>>>>>>> when i use e.element(). Like if the function didnt. Exists. > >>>>>>>> I assing each function with to > >>>>>>>> titulo=lista_izq[j].childElements()[0]; > >>>>>>>> with a FOR loop. > > >>>>> -- > >>>>> Kevin Porter > >>>>> Advanced Web Construction > >>>>> Ltdhttp://webutils.co.ukhttp://billiardsearch.nethttp://9ballpool.co.uk > > >>>>> AJAX Blackjack - real-time multi-player blackjack game with no flash, > >>>>> java or software downloads required -http://blackjack.webutils.co.uk > > -- > Kevin Porter > Advanced Web Construction > Ltdhttp://webutils.co.ukhttp://billiardsearch.nethttp://9ballpool.co.uk > > AJAX Blackjack - real-time multi-player blackjack game with no flash, java or > software downloads required -http://blackjack.webutils.co.uk --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group. To post to this group, send email to prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~----------~----~----~----~------~----~------~--~---