function getElementsByClassName(className)
{
// get all elements in the document
if (document.all)
{
var allElements = document.all;
}
else
{
var allElements = document.getElementsByT
我在這裏有一個典型的JavaScript代碼塊(代碼將應用背景風格類到表中交替的奇數或偶數行)。我試圖在CoffeeScript中重寫這個,試圖學習它。 CoffeeScript範圍的語法是不同的,更多的Ruby風格。我非常感謝你如何做到這一點的例子? function alternate(id){
if(document.getElementsByTagName){
var