Getting relative form actions with javascript

The other day I needed to get data from a form and manipulate the "get" manually through javascript. For that to happen I needed to obtain the action attribute of the form. The action of this specific form had to be a relative url. What I found through…

Bug when creating select options using innerHTML in IE

Recently I was creating some code that dynamically changes the options in a select element. In the first draft I decided to us innerHTML for speed. Using innerHTML for this is very straight forward. You build your string of options and dump them into the select. Unfortunately the draw back…

Beginning JavaScript

Christian Heilmann's book is soon to be winging it's way onto the bookshop shelves from the 17th July. Don't let the title mislead you there's some nice and chunky examples to get your teeth into. Check out the book's site to get a feel for what's on offer and get…

getElementsByClassName Deluxe Edition

Anyone who's into JavaScript will most likely have written their own take on a getElementsByClassName function. I had a look around at a few recent examples and then decided to do my own version for fun. Out of all of the functions I looked at Robert Nyman's came closest to…

Element Ready

The idea for this script came about over a pint with Andy Hume back in February. We were talking about how annoying it is that DOMContentLoaded only works for Mozilla and although IE has it's own proprietary 'Defer' method there's not a quick and easy and cross-browser way of checking…

Don't use Javascript to hide bad markup

In a recent post on 456 Berea Street, Jeff Croft made a very valid comment suggesting that using JavaScript to create invalid markup was no better than writing invalid markup in the first place. This is something I totally agree with. The rising popularity of JavaScript following the buzz surrounding…

From DHTML to DOM scripting

In an in-depth article, Christian Heilmann goes through the failings of older DHTML techniques and shows how to fix them with more up to date unobtrusive DOM scripting. See Christian's full article over at icant.co.uk . In the article Christian shows two examples of a dummy site to draw…