Sunday, November 30, 2008

any differences?

This is code no 1:

function caller(xmldata) {
var options =
xmldata.getElementsByTagName("root").item(0);
alert(options.firstChild.data);
}

This is code no 2:

var options =
xmldata.getElementByTagName("root").item(0);
alert(options.firstChild.data);
}

Notice any differences?

Ok one more time



This is code no 1:

function caller(xmldata) {
var options =
xmldata.getElementsByTagName("root").item(0);
alert(options.firstChild.data);
}

This is code no 2:

var options =
xmldata.getElementByTagName("root").item(0);
alert(options.firstChild.data);
}

Its getElementsByTagName for goodness sake! Man I am such a horrible programmer! need to be more careful next time! this mistake nearly costs me a fortune! Goddamnit!

* This code is in javascript. I'm using AJAX for my curent project. tq.

No comments: