Undercrank

Scripting

October 13, 2003

Javascript reserved words in Internet Explorer

It seems that all IE installations are not created equal, especially when versions of Javascript (or is that JScript) are involved. An example in point is when using a script to detect the length of a radio button array.

By default, a radio button array of more than one item will return its length when referenced by its length property. However, if the radio button is part of a collection totalling just one, Javascript will return a value of undefined as it doesn't choose to consider a one item list as an array. Which is fair enough I suppose.

Anyway, the code below works fine with most versions of IE, and indeed our good friends Mozilla, where undefined is presumably declared as a keyword such as true or null.

if (document.forms[0].radioArray.length == undefined) {
  ...handling code...
}

Other times though, IE (of course) will fail rather unceremoniously with the briefly confusing message "'undefined' is undefined". The correct way around this seems to be to use the typeof feature to return a string value, similar the code below.

if (typeof document.formName.radioArray.length == "undefined") {
  ...handling code...
}

More of the same RSS

Yahoo! Web Services news over Atom

aka: "When you realise Yahoo! already serve their news over RSS..."

Yahoo! Web Services news over RSS

I've put together a small project that will create an dynamic RSS 2.0 feed based on the Yahoo! News Search hooks.

Despamming Shortstat (Part 2)

Further to my earlier post about Despamming Shortstat, I've made a small update to the code that has a few improvements on the original.

Importing CSV files to SQLite

"SQLite is different from most other SQL database engines in that its primary design goal is to be simple". Which isn't strictly true...

Post a comment

Remember personal info?