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