|
-
September 29th, 2002, 03:42 PM
#1
comparing negative numbers
The following JavaScript function is supposed to compare two numbers entered in a form and print "yes" if the first number is smaller than the second. It works for two positive numbers; it can compare a positive and a negative number; it cannot compare two negative numbers. Could anyone explain why? Thanks in advance.
function chek(form) {
if (form.elements["a" + 1 + 1].value < form.elements["b" + 1 + 1].value)
form.elements["c" + 1 + 1].value = "Yes";
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|