简体   繁体   中英

when using js in ie, className doesn't work in certain code. is anyone knows the why?

function openBBS() {
    var boardLinker = document.getElementsByClassName('boardLinker');
    for(i = 0 ; i < boardLinker.length+3 ; i++) {
        var allBoards = boardLinker.item('i');
        allBoards.className = "boardLinker_b";}}

I think this problem is being happening to not only me, there are a lot of peoples suffering from similar problem with me.

is there anyone who knows the why this problems happening in only ie, and what is the solution..

You have quotation marks around your i variable within your for loop. Change:

var allBoards = boardLinker.item('i');

To:

var allBoards = boardLinker.item(i);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM