No comprendo bien dónde querés hacer la comparación: en php, en js?
Si la comparación es en php, conviene mandar este mensaje al foro de ajax. Si es en js, deberías indicar donde iniciás el array js contra el cual comparar. En fin, se necesita más información para ayudarte.
Entretanto, fijate si esto te sirve:
Código PHP:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>test</title>
<script>
Array.prototype.in_array=function(){
for(var j in this){
if(this[j]==arguments[0]){
return true;
}
}
return false;
}
var vec=[];
function guardarYComprobar(elem){
if(vec.in_array(elem)){
alert('nop');
}else{
vec.push(elem)
}
}
</script>
</head>
<body>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="./images/cards/back.jpg" name="card1" width="80" height="130" onclick="this.src='./images/cards/26.gif';guardarYComprobar(this.src)"></td>
<td><img src="./images/cards/back.jpg" name="card2" width="80" height="130" onclick="this.src='./images/cards/6.gif';guardarYComprobar(this.src)"></td>
<td><img src="./images/cards/back.jpg" name="card3" width="80" height="130" onclick="this.src='./images/cards/30.gif';guardarYComprobar(this.src)"></td>
<td><img src="./images/cards/back.jpg" name="card4" width="80" height="130" onclick="this.src='./images/cards/14.gif';guardarYComprobar(this.src)"></td>
<td><img src="./images/cards/back.jpg" name="card5" width="80" height="130" onclick="this.src='./images/cards/20.gif';guardarYComprobar(this.src)"></td>
<td><img src="./images/cards/back.jpg" name="card6" width="80" height="130" onclick="this.src='./images/cards/1.gif';guardarYComprobar(this.src)"></td>
</table>
</body>
</html>