Categories
- global (3)
- html (1)
- javascript (1)
- prototype (1)
Archives
Hyperlinks
Scriptaculous: AJAX autocomplete with real-time values
April 1 2009 @ 2:53 pmprototype: expand/collapse all elements in a class
March 17 2009 @ 11:07 am
// put this is your in your head section, it starts the magic
//this also goes in the head section, but is where each element -- with the said class -- will be manipulated.
You can do anything inside this function, where c is each element. This code specifically expands and collapses each element.
function toggleElements(classname){
$$('.'+classname).each(
function(c){
if(c.style.display == 'none'){
c.setStyle({display: 'block'});
}else{
c.setStyle({display: 'none'});
}
}
);
}
toggleElements('divclassname');
// this can be added to an HTML onclick event to fire when the button is clicked, like zoy:
Hello world!
March 5 2009 @ 1:51 pmSeeing how this blog is about CODE, I couldn’t delete the default post. That’s how easy Wordpress is, writes theĀ hello world program for you. Wish I had a language/IDE that did that for me. Dare to dream.
So for the first post, I thought a simple javascript to explain what it would take to write hello world to a page. Why Hello World, it is tradition.