View Full Version : alert on wrong data type

09-01-2006, 01:45 AM
need an alert to pop up when some1 try's to input somthin other than a number into my form so if they try type a into age it will alert then that i want numerical input

09-01-2006, 02:56 AM
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
<script type="text/javascript">
function isNum()
var thetest = document.forms[0].nums;
alert('You can only enter numbers');
thetest.value = '';

<form action="#" method="post">
<input type="text" name="nums" onKeyUp="isNum()" size="3" maxlength="3">

09-01-2006, 01:51 PM
aero that not working do i need 2 edit anything?

09-01-2006, 07:09 PM
Post the code you are using and I'll let you know. You do need to change var thetest to match your input name. In the code I posted the input name is nums. Please try using proper English and complete sentences.