PDA

View Full Version : Pick Three Numbers - Alert if win.



dantown
04-04-2011, 07:37 PM
Hi, greeting all.

could you help me please to edit this javascript, I'd like to get a message alert if the values stopped on three same numbers, else try again

Live Demo (http://javascript.internet.com/games/pick-three-numbers.html)
http://javascript.internet.com/games/pick-three-numbers.html

HEADE:

<script language="JavaScript">

function begin() {
i=0;
document.form.col1.value="V";
document.form.col2.value="V";
document.form.col3.value="V";
roll(speed);
}
function roll(speedB) {
if (document.form.col1.value=="V") {
document.form.a1.value=Math.floor(Math.random()*9) +0 ;
}
if (document.form.col2.value=="V") {
document.form.a2.value=Math.floor(Math.random()*9)+0 ;
}
if (document.form.col3.value=="V") {
document.form.a3.value=Math.floor(Math.random()*9)+0 ;
}
timerid=setTimeout("roll("+speedB+")",speedB);
}
function stop(col) {
if ( col==1) if(document.form.col1.value!=" "){
document.form.col1.value=" ";i++;}
if ( col== 2) if(document.form.col2.value!=" "){
document.form.col2.value=" ";i++;}
if ( col==3) if(document.form.col3.value!=" "){
document.form.col3.value=" ";i++;}
// speedB=500000;roll(speedB);
}
</script>

BODY:

<script language="JavaScript"><!--
var speed=250,i=0,timerid;
-->
</script> Best Regards.