Saw this interesting discussion about whether we should use href="javascript:void(0)" or href="#" with onClick event handler on Stack Overflow.
I think the best solution is to avoid using link element <a> in the first place and use CSS to style an element to make it "look" like a link and attach the event handler to that element. This article has more discussions and comparisons why we should not use links in this particular case.
As for why the event handler need to return false, it is because we want to avoid the default behavior of the link element, i.e. to follow the href and go to another page. This quirksmode article has it very clearly explained.
Tuesday, November 9, 2010
Monday, November 8, 2010
node.js setup on Mac
node.js has been getting a lot tractions lately due to its high performance on V8 engine, event-based model and reusability of client side JavaScript on server side without any changes.
There are several articles discussing how to set it up on the Mac and I found this one from Florian Kubis to be the easiest to follow.
If you are using homebrew as your package management system instead of MacPorts, you should use this tutorial instead.
The tutorials also cover npm (the package manager for node.js) and express (a Web app framework built for node.js)
There is no MacPorts ports for npm and express yet, maybe someone should create them?
Several slides and quick intro about node.js:
There are several articles discussing how to set it up on the Mac and I found this one from Florian Kubis to be the easiest to follow.
If you are using homebrew as your package management system instead of MacPorts, you should use this tutorial instead.
The tutorials also cover npm (the package manager for node.js) and express (a Web app framework built for node.js)
There is no MacPorts ports for npm and express yet, maybe someone should create them?
Several slides and quick intro about node.js:
- "Evented I/O based web servers, explained using bunnies", the idea behind node.js in 10 pages
- "Node.js and websockets intro", a bit more technical than the bunnies example
- "Node.js: how JavaScript is changing server programming", more details in 65 pages
- "Running YUI3 on node.js", integration with YUI3, moving client js to server side without any changes!
Subscribe to:
Posts (Atom)