CodingJavascript help

 

Press Ctrl+Enter to quickly submit your post
Quick Reply  
 
 
  
 From:  99% of gargoyles look like (MR_BASTARD)  
 To:  Wattsy (SLAYERPUNX)      
37533.47 In reply to 37533.46 
Ah, yes, I see now. If the number is outside the range the alert pops up, but the next line is executed nonetheless.
Try sticking this line below the alert:
code:
return false;
Or, preferably, adding an else clause:
code:
function getChosenNumber()
{
	numberChosen=
    window.prompt('Player ' + currentPlayer + ' please choose a number between 1 and 3.','');
	if (numberChosen < 1 || numberChosen > 3)
	{
	   alert('please choose a number between 1 and 3');
	   return false;
    } else
	   {
	return numberChosen;
	   }
}
 

bastard by name, bastard by nature

0/0
 Reply   Quote More 

Reply to All    
 

1–20  21–40  41–47

Rate my interest:

Adjust text size : Smaller 10 Larger

Beehive Forum 1.5.2 |  FAQ |  Docs |  Support |  Donate! ©2002 - 2024 Project Beehive Forum

Forum Stats