Friday, September 29, 2006

jQuery and an example: Dynamic Stylesheet Switcher

I've just found a fantastic JavaScript library called jQuery.
jQuery is a Javascript library that takes this motto to heart: Writing Javascript code should be fun.

Here's a cool example of using it: Dynamic Stylesheet Switcher.

Levels of JavaScript Knowledge

Dean Edwards rules! Look at the comment #77, though :)

I understand level 5, but I don't know yet why

var button = document.getElementById("hello");
button.addEventListener("click", function(event) {
hello(WORLD);
}, false);

is better than

var button = document.getElementById("hello");
button.onclick = function() {
hello(WORLD);
};

Could someone explain it?