Hi ppl, i’m new to this javascript situation, and am programming a simple website for the laugh… have 2 problems, the first is a prompt box situation where my code isnt supposed to read in letters, for example the user will be prompted to input how much money they want to lodge, if they add a string i get the NaN thing print out….
this is my code: (yes i no it’s very noobyish but my head is in bits atm lol)
function promptMsg()
{
lodge = prompt(‘how much would you like to lodge?’,0);
if (lodge == “A” || “B” || “C” || “D” || “E” || “F” || “G” || “H” || “I” || “J” || “K” || “L” || “M” || “N” || “O” || “P” || “Q” || “R” || “S” || “T” || “U” || “V” || “W” || “X” || “Y” || “Z”)
{
alert(“Error! Number input only!”);
}
//the method continues on here but thats working.
//this was supposed to sort out the NaN issue in case the user inputs a string however it doesnt, it ends up causing the error alert to pop up even when i input a number…. ne1 tell me wat i’m doing wrong and b able to give me some insight in how to get it to ignore letters and symbols and just accept numbers?