Developing Clean AJAX / Javascript Driven Websites; Say No To Tag-Soup
Behaviour promotes itself as "the missing link for your AJAX apps". It allows you to use CSS selectors (like id or class) to apply Javascript behaviors to your HTML elements.
No more embedding Javascript tags in your HTML. What Behaviour (note the British spelling) does is allow you to define rules where you associate javascript functions with CSS selectors.
Let's look at an example (from their site):
Instead of writing:
With Behaviour we can write:
- id="example">
- Click me to delete me
There is no Javascript embedded in HTML. The actual Javascript function is defined and associated separately.
var myrules = {
'#example li' : function(el) {
el.onclick = function() {
this.parentNode.removeChild(this);
}
}
};
Behaviour.register(myrules);
It worked pretty well in my tests. Very much recommended unless you are into code obfuscation. You can download it here.
Filed under Headline News, How To, Open Source Software, Tech Note, Web, Web Services |
|
RSS 2.0 |
Trackback this Article
|
Email this Article
You may also like to read |





































November 22nd, 2005 at 6:59 am
[...] Java IDE For StudentsBehaviour promotes itself as “the missing link for your AJAX apps” and software outsourcing in China hindered by IT talent shortage, whereas, A class action lawsuit against Sony BMG Music Entertainment has been filed in California. [...]