You should not use default
as a variable name, as it is reserved.
Just use a different name instead.
From the documentation (7.6.1.1 Keywords),
The following tokens are ECMAScript keywords and may not be used as Identifiers in ECMAScript programs:
break, do, instanceof, typeof, case else, new, var, catch, finally, return, void, continue, for, switch, while, debugger, function, this, with, default, if, throw, delete, in, try
Edit:
As @CrazyTrain said, document.getElementsByClassName
is not supported. You could replace it with a shim like this:
function getElementsByClassName(needle) {
var my_array = document.getElementsByTagName("*");
var retvalue = new Array();
var i;
var j;
for (i=0,j=0;i<my_array.length;i++) {
var c = " " + my_array[i].className + " ";
if (c.indexOf(" " + needle + " ") != -1) retvalue[j++] = my_array[i];
}
return retvalue;
}
Which you would call like this:
var mitms = getElementsByClassName('mitm');