Aspect oriented programming, or AOP, is a powerful technique being used in Java, C#, and other server-side languages. It gives you a way of dealing with what are known as crosscutting concerns, features of an application that transcend the responsibilities of individual objects. From the Wikipedia entry:
Separation of concerns entails breaking down a program into distinct parts that overlap in functionality as little as possible. All programming methodologies-including procedural programming and object-oriented programming-support some separation and encapsulation of concerns (or any area of interest or focus) into single entities. For example, procedures, packages, classes, and methods all help programmers encapsulate concerns into single entities. But some concerns defy these forms of encapsulation. Software engineers call these crosscutting concerns, because they cut across many modules in a program.
Logging offers one example of a crosscutting concern, because a logging strategy necessarily affects every single logged part of the system. Logging thereby crosscuts all logged classes and methods.
The way that AOP is usually implemented is by wrapping "advice," or additional behavior, around existing method calls. This is a little tricky in languages like java, and can involve precompiling code or modifying byte code in jars or on-the-fly. Frameworks like Spring and tools like AspectJ give you the necessary machinery and plumbing to get AOP done in Java.
Over at Cubicle Muses, William Taysom has an interesting article on adding AOP to JavaScript. You’ll be surprised how simple it is. Maybe you are already doing something like it and didn’t know the name for it, or just lacked the point of view to make greater and more effective use of it. Beyond giving you the ability to deal with crosscutting concerns like logging, the technique gives you a powerful way to modify the behavior of existing JavaScript libraries. Go ye and check it out.

If you’re using jQuery, there’s a plug-in available for AOP: http://code.google.com/p/jquery-aop/
the jquery plugin works great!!!