What's wrong with this javascript?
Posted
by Arlen Beiler
on Stack Overflow
See other posts from Stack Overflow
or by Arlen Beiler
Published on 2010-05-18T19:05:09Z
Indexed on
2010/05/18
19:10 UTC
Read the original article
Hit count: 357
What's wrong with this code?
var divarray = document.getElementById("yui-main").getElementsByTagName("div");
var articleHTML = array();
var absHTML;
var keyHTML;
var bodyHTML = array();
var i = 0;
for ( var j in divarray) {
if(divarray[i].className == "articleBody"){
alert("found");
articleHTML = divarray[i];
break;
}
bodyHTML[i] = '';
if(articleHTML[i].className == "issueMiniFeature"){continue;}
if(articleHTML[i].className == "abstract"){absHTML = articleHTML[i]; continue;}
if(articleHTML[i].className == "journalKeywords"){keyHTML = articleHTML[i]; continue;}
bodyHTML[i] = articleHTML[i];
i++;
}
This is the error I am getting:
ReferenceError: array is not defined
I am using Google Chrome if it helps any.
© Stack Overflow or respective owner