Script Object Required Error

G

Glenn

When I run this code as part of a HTML page it responds with object required

Line 95 Char 5 witch I have marked in the code. Can anyone see a problem.

P.S. I am only a student, I know the code isn't very well written

Thanks

Glenn

function processClick(){

var p = 1;
var orded = true;


for(var row = 0; row <= 3; row++){ //Loop through sells array

for(var col = 0; col <= 3; col++){

*************Error********** if((event.srcElement.parentElement.id) ==
"cell" + [row] + [col] ){

swapped = false;
//Check to see if there is a white space adjacent to the
clicked cell.
if(row != 0 && (cells[row-1][col]).innerText == " "){
swap(cells[row][col],cells[row-1][col]);

}else{

if(col != 3 && (cells[row][col+1]).innerText == " "){

swap(cells[row][col],cells[row][col+1]);

}else{

if(row != 3 && (cells[row+1][col]).innerText == " "){
swap(cells[row][col],cells[row+1][col]);

}else{

if(col != 0 && (cells[row][col-1]).innerText == " "){

swap(cells[row][col],cells[row][col-1]);
}
}
}
}

if(swapped == false){
window.alert("This move is not allowed"); //If there is no white
space produce and error dialog box

}


if(cells[row][col].innerText == p){

p++;

}else{

orded = false;

}

if(orded == true){

if (confirm("Would you like to play again")){

start();

}else{

}

}

}
}
}









}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,012
Latest member
RoxanneDzm

Latest Threads

Top