var arr = new Array();
arr = document.getElementsByClassName("repestyl2");
    var index = 0;
while(index !== arr.length){
    if(arr[index].innerHTML.indexOf("Eck") >= 0){
    arr[index].removeNode(true);    
    arr[index].parentNode.removeChild(arr[index]);
    index++;
    }

Is this code ok? Because I can't get it to work :)
Simple question :P
Thanks :)
Maybe I should use for-each o.O

Here's an annotated version to describe what's going on.

var arr = new Array();//arr is an array.
arr = document.getElementsByClassName("repestyl2");//whoops, now arr is a DOM node. The array has been discarded.
var index = 0;//OK
while(index !== arr.length){//arr is a DOM node, which doesn't have a length property
    if(arr[index].innerHTML.indexOf("Eck") >= 0){//again arr is not an array
        arr[index].removeNode(true);//and again
        arr[index].parentNode.removeChild(arr[index]);//and again
        index++;//ok
    }//ok, end of if clause
}//missing end of while loop

To add element(s) to an array you can do any of the following:

var arr = new Array(v1, v2, v3); //add variables at indexes 0, 1 and 3 
var arr = [v1, v2, v3]; //Same as above.
var arr = [];//new empty array.
//then ...
arr[0] = v1; //set a specific index (0 in this example)
arr.push(v1); //add v1 to the end of the array
arr.unshift(v1); //add v1 to the beginning of the array
arr['name']; //add a named (associative) element

I think that's about it.

Airshow

Thanks for your time. :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.