Hi, The problem is here:
> for(s in allDivs) The "for..in" construct isn't for looping through the elemnts of an array (although lots and lots of people have been mislead into thinking it is!), it's for looping through the properties of an object. Details, an explanation of why those loops behave differently when Prototype is included, and suggestions for dealing with it here: http://proto-scripty.wikidot.com/prototype:tip-looping-through-arrays HTH, -- T.J. Crowder tj / crowder software / com Independent Software Engineer, consulting services available On Mar 23, 9:12 am, jazzylicious <[email protected]> wrote: > Hi there, > > First of all, I have been working now with prototype in combination > with scriptalous to create some animations on my website and it's > working great and very simple! > > But, I just discovered that by including the prototype.js & > scriptalous.js, the function shown below doesn't execute properly > anymore. > > Debugging in Firefox gives no errors but strange behavior, and IE > gives me an error with Object not set error, this occurs on the line > " document.getElementById(allDivs[s]).style.display = 'none';" where s > strangely alooks like to be "lastindexof". > > I might get some replys with: So you do use prototype, but don't use > it for everything??? I just couldn't find a way to do the same thing > in prototype. > > I hope someone can help me and thank you in advance for your help. > > Jochem van Grondelle > > <pre> > function toggle(div) > { > var allDivs = new Array > ("divreferenties","divreferentie106","divreferentie107","divreferentie108","divreferentie109","divreferentie110","divreferentie111","divreferentie112","divreferentie113","divreferentie114","divreferentie115","divreferentie116","divreferentie117","divreferentie166","divreferentie209"); > document.getElementById('refterug').style.display = ''; > for(s in allDivs) > { > document.getElementById(allDivs[s]).style.display = 'none';} > > document.getElementById('refempty').style.display = ''; > document.getElementById('refempty').style.display = 'none'; > document.getElementById(div).style.display = ''; > if (div == 'divreferenties') {document.getElementById > ('refterug').style.display = 'none';} > else {document.getElementById('refterug').style.display = '';} > > }//]]> > > </pre> --~--~---------~--~----~------------~-------~--~----~ 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 [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~----------~----~----~----~------~----~------~--~---
