Javascript

Measuring element dimensions and placement in javascript on 11 Aug 05 (2 comments)

I found a really useful page on the MSN site that explains how measuring element dimensions and locations work in javascript. There’s a great image that shows you how to measure any of the different areas using the different javsacript width, height and placement properties.

Back referencing in javascript regular expressions on 21 Jul 05 (1 comment)

I’ve used regular expressions to do find and replace Javascript before, but I’ve never managed to do the thing where you can take part of the string that has been matched and use it in the replace string. It turns out the piece of the puzzle I needed to find was something called back references. […]

Handling SelectedIndexChange for a DropDownList in a Repeater on 25 Jan 05 (5 comments)

Came across an interesting problem yesterday trying to handle the SelectedIndexChanged event for a DropDownList that was inside a Repeater. I found a wonderful article on Databinding that gave me most the information I needed, but their method of handling events just didn’t work for me. My first problem was that I originally did the […]

XMLHttpRequest and Google suggest on 13 Dec 04 (Add comment)

Wow! I didn’t even know about the XMLHttpRequest object that powers Google suggest. This is the first thing I’ve seen in *ages* that seriously changes how we can make webpages. :) I’m so glad that the web is still an exciting place to hang out.

Automatically initialising Javascript objects that require the DOM on 23 Nov 04 (Add comment)

One of the problems I had when I first started creating Javascript widget objects is that I always needed to create the object in two stages. First I’d actually create an object with the correct parameters, then I’d register a piece of script that actually did all of the initialisation code that accessed the DOM […]

A DOM friendly way of getting values from radio buttons on 17 Nov 04 (Add comment)

The problem with radio buttons is they don’t work like ordinary form elements. You can’t just apply an ID to a radio group, use document.getElementById() to get a reference to it and then query the value. This means to find the value of my radio group I’ve had to use the old fashioned document.forms[0].groupName method […]

Accessing current style attributes on 07 Oct 04 (Add comment)

Had a problem this morning trying to access the display property of html form elements that were hidden because one of their parent elements had the style.display property set to “none”. <tr style=”display:none”> <td><input name=”foo”/></td></tr> My script worked fine when I called document.getElementById(“moo”).style.display on the elements whose display property I had set to “none”, but […]