0

Could anyone please help me on this problem. The error message saying “object doesn't support this property of method, line 113, characters 5, url: http://xxxx.com/js/category.js” appears when I try to open some site by several IE browsers. I assume that the script called category.js has some problems, or is not just suited for IE browsers. The category.js is used to open and close several levels of category, and the line 113 of category.js is listed below. (No problem for chrome and safari, and some css problem for Opera. IE and FF has never been worked.)

function initCategoryList(){
    var lv = 0;

    while(document.getElementsByClassName("level" + (++lv)).length){ // line 113

        for (var i = 0; i < document.getElementsByClassName("level" + lv).length; i++) {
            setclickevent(document.getElementsByClassName("level" + lv)[i], lv, i);
        }
    }
}
Denys Séguret
  • 372,613
  • 87
  • 782
  • 758
  • 1
    Please note that Java and JavaScript are totally different languages. – Denys Séguret Sep 01 '13 at 14:08
  • This is a frequent question. I linked to a similar question, please feel free to close using another one if you have better links. – Denys Séguret Sep 01 '13 at 14:11
  • Thanks for your time and suggestions. After I applied getElementsByClassName.polyfill.js ie8 worked, but firefox, ie7, and ie6 are still not working. Are there any other polyfill for those browsers? – Ibara nomichi Sep 02 '13 at 07:38

1 Answers1

2

Support for getElementsByClassName first appears in Internet Explorer in version 9. It will not work in earlier versions.

(It may also be disabled when viewing a page in compatibility mode).

If you need to support ancient browsers, there are plenty of pollyfills for getElementsByClassName available.

Quentin
  • 914,110
  • 126
  • 1,211
  • 1,335
  • Thanks, I applied getElementsByClassName.polyfill.js and it worked for IE8, but FireFox, IE7, and IE6 are still not working even though I do not get the same error messages any more. Do you have any ideas or suggestions what else I should do regarding on this issue to get FireFox,IE7, and IE6 working? Are there any other pollyfills for this problems? I appreciated your time. – Ibara nomichi Sep 01 '13 at 17:47