Hi, I've inherited a prototype.js application, and I'm getting this
error in FF3.0.  It works in IE8.  I've looked for the solution but
can't figure it out.

dropList.each is not a function
http://localhost/www/js/assign.js
Line 8

Why does it load in IE, but not in FF?

Here is the html:

<head>
<script src="/www/js/prototype.js" type="text/javascript">
<script src="/www/js/assign.js" type="text/javascript">
</head>
<body>Stuff</body>

Here is assign.js:

// hook this into onload using Prototype
Event.observe(window,'load',dropListChange);

// this function happens once on page load.
function dropListChange() {
  var dropList = document.getElementsByClassName("dropdown","assign");

  dropList.each( function(listName) {
    alert('hello world');
    listName.onchange = sendChange;
  });
}

function sendChange() {
  var idName = this.id;
  var newVal = this.value;
  new Ajax.Request(endpoint, {
    asynchronous: true,
    method: "get",
    parameters: "id=" + idName + "&v=" + newVal,
    onSuccess: receiveChange,
    onError: showError
  });
  if (newVal == -1) {
    alert("If you wish to assign this survey to multiple users, you
must assign subsections of it to individual users.");
  }
}

function receiveChange(xhr) {
  var respData = eval(xhr.responseText);
  respData.each(function(list) {
    if ($(list.elem)) {
      $(list.elem).value = list.userid;
    }
  });
}

function showError(xhr) {
  alert("Ajax error in assign.js");
}

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to