<HTML> <HEAD> <Script TYPE="text/javascript"> <!-- var getNumber, iValue, rNumber, Num, num, imgnum, i, j, r, s, n; var cards = 5; var clk = 0; img=new Array(); Num1=new Array(); Num2=new Array(); function display_image(){ if(navigator.appVersion.charAt(0)>=3){ for(i = 1; i <= cards; i++){ img[i] = new Image(); img[i].src = "image/esp"+i+".gif"; } Randoms(cards); getNumber = rNumber; document.Img0.src = img[rNumber].src; for(i = 1; i <= cards; i++){ Randoms(cards); if(i == 1){ Num1[i] = rNumber; Num2[i] = rNumber; } else{ for(j = 0; j < Num2.length; j++){ if(Num2[j+1] == rNumber){ n = 0; break; } else{ n = 1; } } if(n == 0){ i--; } else{ Num1[i] = rNumber; Num2[i] = rNumber; } } } } } function change_image(num){ if(navigator.appVersion.charAt(0)>=3){ imgnum = Num1[num]; document.images["Img"+num].src=img[imgnum].src; if( getNumber != imgnum){ clk++; } else{ if(clk == 0){ window.alert("Congratulations! Are you ESP?"); } else if( clk > cards-2 ){ window.alert("Too bad! You loose."); } else{ window.alert("You got the same card."); } } } } function Randoms(r){ iValue = Math.random() * r; rNumber = Math.ceil(iValue); } //--> </SCRIPT> </HEAD> <BODY onLoad="display_image()"> <TABLE WIDTH="350" BORDER="0" CELLSPACING="0" CELLPADDING="0"> <TR> <TD COLSPAN="5" ALIGN="CENTER"><FONT SIZE="2" CLASS="size2"><IMG SRC="image/esp.gif" WIDTH="60" HEIGHT="80" NAME="Img0"></FONT></TD> </TR> <TR ALIGN="CENTER"> <TD WIDTH="70"><A HREF="javascript:;" onClick="change_image(1)"><IMG SRC="image/esp.gif" WIDTH="60" HEIGHT="80" VSPACE="5" HSPACE="5" NAME="Img1" BORDER="0"></A></TD> <TD WIDTH="70"><A HREF="javascript:;" onClick="change_image(2)"><IMG SRC="image/esp.gif" WIDTH="60" HEIGHT="80" VSPACE="5" HSPACE="5" NAME="Img2" BORDER="0"></A></TD> <TD WIDTH="70"><A HREF="javascript:;" onClick="change_image(3)"><IMG SRC="image/esp.gif" WIDTH="60" HEIGHT="80" VSPACE="5" HSPACE="5" NAME="Img3" BORDER="0"></A></TD> <TD WIDTH="70"><A HREF="javascript:;" onClick="change_image(4)"><IMG SRC="image/esp.gif" WIDTH="60" HEIGHT="80" VSPACE="5" HSPACE="5" NAME="Img4" BORDER="0"></A></TD> <TD WIDTH="70"><A HREF="javascript:;" onClick="change_image(5)"><IMG SRC="image/esp.gif" WIDTH="60" HEIGHT="80" VSPACE="5" HSPACE="5" NAME="Img5" BORDER="0"></A></TD> </TR> <TR ALIGN="CENTER"> <TD COLSPAN="5"> <FORM> <INPUT TYPE="BUTTON" VALUE="One More TRY!" onClick="location.reload()"> </FORM> </TD> </TR> </TABLE> </BODY> </HTML> |