if(document.getElementById("L1C1").src=="croix.jpg" && document.getElementById("L1C2").src=="croix.jpg" && document.getElementById("L1C3").src=="croix.jpg"){ alert("gagne"); }
if((document.getElementById("L1C1").src "croix.jpg") && (document.getElementById("L1C2").src "croix.jpg") && (document.getElementById("L1C3").src == "croix.jpg")){ alert("gagne"); }
Mon problème se situe au niveau de la fonction f_verif().
Je ne sais pas comment détecter l'utilisation soit de croix.jpg soit de rond.jpg.
(...)
function f_verif(){
if((document.getElementById("L1C1").src "croix.jpg") && (document.getElementById("L1C2").src "croix.jpg") && (document.getElementById("L1C3").src = "croix.jpg")){
alert("gagne");
}
function f_verif(){ if((document.getElementById("L1C1").src "croix.jpg") && (document.getElementById("L1C2").src "croix.jpg") && (document.getElementById("L1C3").src == "croix.jpg")){ alert("gagne"); }
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionvar hasard = Math.random(); if(hasard>0.5){ a_qui_le_tour = false; alert("joueur1 commence"); } else { a_qui_le_tour = true; alert("joueur2 commence"); }
Il fallait avoir
Code ActionScript :
if(document.getElementById("L1C1").src= ="croix.jpg" && document.getElementById("L1C2").src=="croix.jpg" && document.getElementById("L1C3").src=="croix.jpg"){
alert("gagne");
}
A la place de
Code ActionScript :
if((document.getElementById("L1C1").src "croix.jpg") && (document.getElementById("L1C2").src "croix.jpg") && (document.getElementById("L1C3").src == "croix.jpg")){
alert("gagne");
}
document.getElementById("L1C1").src.substr(document.getElementById("L1C1").src.lastIndexOf("/")+1) == "croix.jpg"
document.getElementById("L1C1").src == "croix.jpg"
if((document.getElementById("L1C1").src.substr(document.getElementById("L1C1").src.lastIndexOf("/")+1) == "croix.jpg") && (document.getElementById("L1C2").src.substr(document.getElementById("L1C2").src.lastIndexOf("/")+1) == "croix.jpg") && (document.getElementById("L1C3").src.substr(document.getElementById("L1C3").src.lastIndexOf("/")+1) == "croix.jpg")) { alert("gagne"); }
if(document.getElementById("L1C1").src=="http://monftp/morpion/img/croix.jpg" && document.getElementById("L1C2").src=="http://monftp/morpion/img/croix.jpg" && document.getElementById("L1C3").src=="http://monftp/morpion/img/croix.jpg"){ alert("gagne"); }
var PATH_IMG_ROND="http://monftp/morpion/img/rond.jpg"; var PATH_IMG_CROIX="http://monftp/morpion/img/croix.jpg";