[Proto-Scripty] Re: Prototype causes function with array/for...each to stop working

2009-03-23 Thread Chris Sansom

Oooh - don't say there's a post I can answer...

At 02:12 -0700 23/3/09, jazzylicious wrote:
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.

...

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';
}

Try this instead:

allDivs.each(function(s)
{
document.getElementById(allDivs[s]).style.display = 'none';
});

Or, even better:

allDivs.each(function(s)
{
$(allDivs[s]).style.display = 'none';
});

-- 
Cheers... Chris
Highway 57 Web Development -- http://highway57.co.uk/

Star Wars won't work.
-- Frank Zappa

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Prototype causes function with array/for...each to stop working

2009-03-23 Thread jazzylicious

Great, thanks for the super duper quick replies

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[Proto-Scripty] Re: Prototype causes function with array/for...each to stop working

2009-03-23 Thread Maarten

Hi Jochem,

You definitely want to look into the following functions:

http://www.prototypejs.org/api/enumerable/invoke
enables you to hide multiple elements at once, e.g.:

 $$(.referentie).invoke(hide); // works if you'd add
class=referentie to the div elements you want to hide

And instead of:

 document.getElementById('refempty').style.display = '';

You can just do:

 $(refempty).hide();

Good luck,
 Maarten

Less code and easier to read too :)
On 23 mrt, 10:57, jazzylicious joc...@vangrondelle.net wrote:
 Great, thanks for the super duper quick replies
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---