Javascript

Back referencing in javascript regular expressions

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. What [...]
Published in Javascript on Thursday, July 21st, 2005

Handling SelectedIndexChange for a DropDownList in a Repeater

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 databinding when [...]
Published in ASP.NET, Javascript on Tuesday, January 25th, 2005

XMLHttpRequest and Google suggest

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.
Published in Javascript on Monday, December 13th, 2004

Automatically initialising Javascript objects that require the DOM

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 [...]
Published in Javascript on Tuesday, November 23rd, 2004

A DOM friendly way of getting values from radio buttons

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 [...]
Published in Javascript on Wednesday, November 17th, 2004

Accessing current style attributes

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 when I [...]
Published in Javascript on Thursday, October 7th, 2004