2 * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
\r
3 * Copyright (C) 2002-2004 The Nucleus Group
\r
5 * This program is free software; you can redistribute it and/or
\r
6 * modify it under the terms of the GNU General Public License
\r
7 * as published by the Free Software Foundation; either version 2
\r
8 * of the License, or (at your option) any later version.
\r
9 * (see nucleus/documentation/index.html#license for more info)
\r
11 * script the check (on the clientside) if a entered value
\r
12 * is a valid number and remove the invalid chars
\r
14 * $Id: numbercheck.js,v 1.1.1.1 2005-02-28 07:14:02 kimitake Exp $
\r
17 function checkNumeric(f)
\r
21 for (i = 0; i < f.value.length; i++) {
\r
22 c = f.value.substring(i,i+1);
\r
23 if (isInteger(c) || ((c == '.')&&(dot == false)) || ((i == 0)&&(c == '-'))) {
\r
33 function isInteger(value)
\r
35 return (parseInt(value) == value);
\r