Wednesday, 15 July 2015

javascript - Console Error Message for removing Elements -



javascript - Console Error Message for removing Elements -

i got function removing elements site. when click "ok" button console tells me "removeelements not defined"...?! in sentiment done right.

here code:

function showpic(obj, yes) { var obj = (yes) ? obj : this; if(!istimerunning) { istimerunning = true; chronoid = setinterval(function() { chronometro() }, 1000); pointers[game] = chronoid; } if(!waitasecond) { if(!imagesingame.isinarray(obj)) { return; } if(!clicks.length) { clicks[0] = obj; if(!openedimages.isinarray(obj)) { notopenedimages.deleteelementbyvalue(obj.divnum, 'divnum'); } obj.firstchild.style.display = 'none'; } else { if(clicks[0].divnum == obj.divnum) return; clicks[1] = obj; if(!openedimages.isinarray(obj)) { openedimages.push(obj); notopenedimages.deleteelementbyvalue(obj.divnum, 'divnum'); } obj.firstchild.style.display = 'none'; waitasecond = true; checkidentity(); document.getelementbyid('numberoftries' + game).value = allplayers[player]['failures']; } } } function showpiconclick() { if(humanplayer) showpic(this, true); } function checkidentity() { if(clicks[0].imagenum == clicks[1].imagenum) { countpairs(); imagesingame.deleteelementbyvalue(clicks[0].imagenum, 'imagenum'); openedimages.deleteelementbyvalue(clicks[0].imagenum, 'imagenum'); addelement('match_div_one_'+clicks[1].imagenum, "img"); addelement('match_div_two_'+clicks[1].imagenum, 'inhalt1'); addelement('match_div_three_'+clicks[1].imagenum, 'inhalt1'); addelement('match_div_button_'+clicks[1].imagenum, '<button onclick="removeelements()">ok</button>'); /*alert(messages[clicks[1].imagenum]); */ gotlastpair = player; waitasecond = false; clicks.clean(); checkforgameend(); } else { allplayers[player]['failures']++; turnid = settimeout(function() { hidepics() }, timeout); } } function removeelement(divnum) { var olddiv = document.getelementbyid(divnum); olddiv.parentnode.removechild(olddiv); } function removeelements() { removeelement('match_div_one_'+clicks[1].imagenum); removeelement('match_div_two_'+clicks[1].imagenum); removeelement('match_div_three_'+clicks[1].imagenum); removeelement('match_div_button_'+clicks[1].imagenum); }

javascript

No comments:

Post a Comment