Regular Expressions are a powerful utility within the JavaScript language. Essentially it allows you to search and manipulate strings of text with both simple and complex patterns.
Regular Expression Basics
February 7th, 2010Mixin Classes as a way to reuse JavaScript code
January 3rd, 2010This is a useful example of how you can augment a Class to have a particular method but not by using strict inheritance or by duplicating the relevant code for each Class you have. I came across this technique (known as “Mixin Classes”) while reading the book “Pro JavaScript Design Patterns”.
Grab HTML fragment with AJAX
December 3rd, 2009If you’re new to AJAX you may be wondering how you can pull in just a single element from another HTML page (as calling an HTML page with AJAX pulls the entire HTML content in as a String).
It has also been explained to me that the particular solution I’m going to discuss here is the same technique used by the jQuery library.
Cross Browser JavaScript DOMContentLoaded
November 8th, 2009This post shows you how you can call your JavaScript functions once the Document Object Model is ready (which is a lot faster than waiting for the page to finishing loading when using window.onload).
The following code is an amalgamation of the work of Jesse Skinner and Byron McGregor. It keeps track of the methods passed into the addDOMLoadEvent function and supports all modern browsers such as Firefox, Chrome, Opera, Safari (higher than 525) and falls back to window.onload for those browsers that fail all the other checks.
I’ve also updated the code to take into account one particular issue I found with previous versions when using the doScroll method of targeting Internet Explorer which would sometimes return “unavailable”, as well as fixing a Firefox error when hitting the Safari targeted code.
Calling an ActionScript function from JavaScript
October 27th, 2009If you need to access your Flash/ActionScript functions via JavaScript then the easiest way to do this is with the ExternalInterface API (click here to read the Adobe documentation).