English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

i want to alert the user if they enter any number over 50.

how do i get it to work...want am i doing wrong.


if (document.form1.textfield.value = > 50)
alert("please enter number lower than 50")

2007-02-27 17:25:16 · 4 answers · asked by g_playa_gent 1 in Computers & Internet Programming & Design

4 answers

Hmm, things have apparently changed in the past few versions of Javascript. It used to be you couldn't do an mathematical operation straight from a form element.

Anyways, the comparison operator that you should use is

>=

not

=>

.

2007-02-27 17:58:46 · answer #1 · answered by Kookiemon 6 · 1 0

function Validate(){
if(form1.textfieldID.value>50){
alert("please enter number lower than 50")
}
}




Note that said by m.trojahn
is only limiting users from typing over 50 character in a textbox, not validating a value that is less than 50

2007-03-02 23:21:51 · answer #2 · answered by Anonymous · 0 0



easier way is just set the field maxlenght to 50, so u don't even need to handle the input size:

2007-02-28 14:35:54 · answer #3 · answered by m.trojahn 1 · 1 0


...........






2007-02-28 04:56:04 · answer #4 · answered by Smutty 6 · 0 0

fedest.com, questions and answers