Tag: JavaScript

JQuery: Open external links in new window

Finally got round to writing a small bit of code to automatically force anchor links to open in new windows if they are for different domains: $(document).ready(function() { var myDomain = ["www.ajgraham.com", "testing.ajgraham.com", "lifestream.ajgraham.com"]; //do NOT include the http:// pls! $(“a[href^='http://']“).each(function() { var slicedHref = $(this).attr(‘href’).slice(7); var slashPosition = slicedHref.indexOf(“/”); [...]

Simple but powerful JQuery Form Validation

I wrote a relatively simple and intuitive form validation script for a client, which they kindly allowed me to release into the open-source community. Contents The Objective The Basics Including The JavaScript Explaining The Code Core Functions Expanded Functions Options HTML Examples Download License To-Do’s Change-log The Objective The aim [...]

XHTML and JavaScript checkbox colour change

I wrote a very simple little piece of JavaScript that changes the colour, background colour and font colour of a checkbox depending on the Mouse Event (onclick, onmouseover and onmouseout) and whether the checkbox is ticked or not. It can also reset it back to its previous settings too. XHTML: [...]

The problem with using the Google Maps API for UK addresses

I love the Google Maps API. Except when using it for UK based addresses. There is a big problem with any app created using the Google Maps API – UK postcodes will NOT be processed, worse still, they return errors. To give some background on the issue, The Royal Mail [...]