JavaScript Tutorials

  • Downloadify: Client-Side File Generation Using JavaScript and Flash

    The following tools is in its very beta stages and works intermittently. Its so damn useful that I had to show it off now though!

  • Test For Popup Blocker Using JavaScript

    Several websites rely on the ever-so-annoying popup window. As much as well all hate popup windows, some websites do benefit and justly require them. The problem is that some people have their popup blocker on but don't know it — thus the new window doesn't open. Of course the browser notifies the user but it isn't always as obvious as it should be. Here's a quick method for testing if your popup window is being blocked.

  • Limiting Variable Scope Using (function(){})();

    Simply put, a scope limiter is a self-executing function that defines a variables, performs a task, and clears those variables so that their scope is limited to the function itself. Take the following JavaScript code, for example:

  • Access JavaScript Object Variable Properties

    Not all JavaScript objects are as easy as MyObject.property. Sometimes you may want to access a property whose key is stored in a variable. Luckily accessing these properties is very easy.

  • META Refresh vs. JavaScript Refresh

    A few days back I was perusing the ESPN.com source code when I found the following snippet of code:

  • JavaScript Copy to Clipboard

    Providing your users the ability to copy text to the clipboard can make your website much more convenient and valuable. Unfortunately Flash 10 broke most of the methods for doing so. Luckily a great library named ZeroClipboard exists. ZeroClipboard uses a pinch of Flash and touch of JavaScript to make copying to the clipboard happen.

  • Code-Parsing Regular Expressions via Lighter.js

    Perfecting a regular expression can take a lot of time and testing but once achieved can be a absolutely golden. While looking through the source code of MooTools syntax highlighter Lighter.js I stumbled upon a few code-parsing regular expressions that you might be interested in.

  • Replace All Occurrences of a String in JavaScript

    One thing you may have noticed is that JavaScript's String.replace() method doesn't act like replacement methods in other languages. Take the following for example:

  • Caching AJAX Results in JavaScript

    AJAX is an awesome tool. AJAX requests are usually faster than regular page loads and allow for a wealth of dynamism within a page. Unfortunately many people do not properly cache request information when they can. Let me show you how I cache AJAX requests — it's super easy!

  • Implementing .css() and .attr() in MooTools 1.2.3

    Very rarely does a developer have the ability to work with just one framework. Often a developer needs to float between MooTools and jQuery. As you can imagine, doing so can make a developer loopy due to the syntax difference. One of the small differences that gets used often is jQuery's attr() and css() vs. MooTools' set() and setStyle(). I've implemented css() and attr() into MooTools for jQuery users.