Hi Juan, 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 Juan Diego wrote: > 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, Juan Diego <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, Juan Diego <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 Ltd http://webutils.co.uk http://billiardsearch.net http://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 -~----------~----~----~----~------~----~------~--~---