i have an input element with a type of text.
I want to check that only numbers are entered in the element.
I also want to alert the user when they enter anything that's not a number.
HTML for the element below.
<input type="text" id="QTY" name="QTY" title="Qty" size="3" onkeypress="key(event)" />
I need help with the function below.
//pseudo code
function key(e)
{
if (e.???? != "a number")
{
alert("Invalid entry. Please enter a number.");
document.getElementById(QTY).value = "";
}
}
Thanks
sj