function getElementsByClassName(className)
{
// get all elements in the document
if (document.all)
{
var allElements = document.all;
}
else
{
var allElements = document.getElementsByTagName("*");
}
var foundElements = [];
for (var i = 0, ii = allElements.length; i < ii; i++)
{
if (allElements[i].className == className)
{
foundElements[foundElements.length] = allElements[i];
}
}
return foundElements;
}
var listItems = document.getElementsByClassName("quirky");
for (var i = 0, ii = listItems.length; i < ii; i++)
{
alert(listItems[i].nodeName);
}
On Coffeescript.org: bawbag = (x, y) -> z = (x * y) bawbag(5, 10) would compile to: var bawbag; bawbag = function(x, y) { var z; return (z = (x * y)); }; bawbag(5, 10); compiling via ...