I love MochiKit, between prototype, and some others, I think Mochi is
the most complete and pretty well documented library, that being said.
I'm having problems using iteration, I want to replace a current
function with the iteration functions, but I'm not sure how.

Here's the code I want to use for iteration:

function news_callback(e) {

  var news_regex =
/(\/news\/item\.tcl\?news_item_id=[0-9]+|\/poll\/one-poll\.tcl\?poll_id=[0-9]+)/g
  temp = new Array();
  news_obj = getElement('newspace').innerHTML
  news_array=news_obj.match(news_regex);
  // how can I use the iteration functions to replace this section?
  for (i=0;i<e.length;i++) {
    temp[i]=e[i].match(news_regex)[0];
  }
  test=compare(news_array,temp);
  // build_news_table simply does all the table work
  if (test!=0) {var
np=getElement('newspane');np.innerHTML=build_news_table(e);
}

function check_news() {
        var o = loadJSONDoc('ajax/news.tcl')
        o.addCallback(function(e) {news_callback(e)})
        o.addErrback(function(e) {alert('Unable to connect - Error:'+e)})
}

Reply via email to