[Phpwm] [OT]event trigger

Greg Jones greg.jones at gmail.com
Thu Mar 15 11:21:30 GMT 2007


> Where did this idea of trying to keep all the javascript out of pages and
> have nothing inline actually come from and what are the perceived benefits?
>
> It might be worth mentioning that both the BBC and SKY news sites make
> extensive use of inline javascript.

It just makes things easier. In the same way that MVC and the concept
of templating help with the server-side bits, and the way using
external CSS is easier to modify than lots of inline style="", keeping
js behaviours external makes them easier to change, and avoids
horrible HTML tags with line-wrapping attributes.

"Unobtrusive Javascript" will give many good articles about the
reasoning, and ways of implementing them.

We use Behaviour.js (http://www.bennolan.com/behaviour/) to attach
events using CSS-style selectors, and prototype's $.observe() method.

Greg



More information about the Phpwm mailing list