Hide and show div element with prototype and scriptaculous?

Maxnk already covered the main issue But, Prototype recommends using the dom:loaded event instead of window. Onload : document. Observe("dom:loaded", bodyOnload) Also, you might try Prototype's Element#toggle or Element#hide instead of Element#setStyle (unless the warning on each page applies to your CSS) function bodyOnload() { $('content1').hide(); $('content2').hide(); }.

Maxnk already covered the main issue. But, Prototype recommends using the dom:loaded event instead of window. Onload: document.

Observe("dom:loaded", bodyOnload); Also, you might try Prototype's Element#toggle or Element#hide instead of Element#setStyle (unless the warning on each page applies to your CSS). Function bodyOnload() { $('content1').hide(); $('content2').hide(); }.

Oh, I simply don't knew how to make it correctly in prototype :( Now I know, thanks! – maxnk Dec 14 '08 at 8:46.

If you want to initially hide elements, its not enough to write the "function bodyOnload". This function should be called at page load by using something like that: window. Onload = bodyOnload; And, of course, I advise you to give jQuery a try :).

Great! It now works. You know this is an example in a book I was trying to learn from.

The author neglected this very important part just as he misleadingly said that the best way to reference the effects library in scriptaculous is like so: instead of like: The book has great reviews on amazon but I don't think any of the reviewers have tried to use the book. They all review for its volume and not the substance of the book. All the examples I've tried to use in the book have not worked.

I've had to go on and figure it out for myself. I guess you could say that I have to read other parts of the book to understand a certain example but for a book that big can one actually do that. If I have to know something the author mentioned before shouldn't I be reminded about it, at least in terms of a book so big that is in fact kind of a reference book?

In case you're wondering: Ajax: The Definitive Guide, by Anthony T. Holdener III Update: The author used an older version of the Scriptaculous and Prototype libraries that's why there was a misunderstanding. If you get this book try to keep this in mind.

I actually now have a deap respect for the book, if only for its share volume.

Thanks for these application of SlideUp and SlideDown. An important remark : it doesn't work under ie7 and ie8 if you don't set a width for the div you want to show or hide. Vincent.

Update: The author used an older version of the Scriptaculous and Prototype libraries that's why there was a misunderstanding. If you get this book try to keep this in mind. I actually now have a deap respect for the book, if only for its share volume.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions