Hello all,
I''ve got a very curios problem with any types of
getElementsByClassName prototypes. My suggestion is that the
getElementsByTagName returns a collection instead of an array. My for
won''t access because of a zero length var from the results. At least
I#ve tried to use the prototype library, but I''ll get no success.
I''m
using sIFR(deactivated the same result) also.
that wont return anything: var e
document.getElementsByClassName(''verteiler'');
With that function I can see the length var in the firebug debugger,
but I can''t read it out:
function getElementsByClassName(strClass, strTag, objContElm) {
strTag = strTag || "*";
objContElm = objContElm || document;
var objColl = objContElm.getElementsByTagName(strTag);
if (!objColl.length && strTag == "*" &&
objContElm.all) objColl objContElm.all;
var arr = new Array();
var delim = strClass.indexOf(''|'') != -1 ?
''|'' : '' '';
var arrClass = strClass.split(delim);
for (var i = 0, j = objColl.length; i < j; i++) {
var arrObjClass = objColl[i].className.split('' '');
if (delim == '' '' && arrClass.length >
arrObjClass.length)
continue;
var c = 0;
comparisonLoop:
for (var k = 0, l = arrObjClass.length; k < l; k++) {
for (var m = 0, n = arrClass.length; m < n; m++) {
if (arrClass[m] == arrObjClass[k]) c++;
if (( delim == ''|'' && c == 1) || (delim ==
'' '' && c =arrClass.length)) {
arr.push(objColl[i]);
break comparisonLoop;
}
}
}
}
return arr;
}
// To cover IE 5.0''s lack of the push method
Array.prototype.push = function(value) {
this[this.length] = value;
}
Thanks for you help..
Cheers,
Florian
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Spinoffs" group.
To post to this group, send email to
rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---