Home Articles FAQs XREF Games Software Instant Books About Feedback Search Site-Map
irt.org logo

Feedback on: Articles

irt.org | About | Feedback | 2378 [ previous next ]

Feedback on:
Articles

Sent by
Russell Cottrell on February 15, 2001 at 12:49:21:

Worth:
Very worth reading

Comments:
Oops, I just sent you a letter and the script was not received. Here it is again:

Hello; I was looking for a way to tell if a variable was a number or not. It seems that there is no standard way to do this. I read your article at http://developer.irt.org/script/39.htm ("Is there a simple way to test if a variable is a number . . .") and came up with another solution, that works in IE 5.01 and NN 4.75:

<SCRIPT LANGUAGE="JavaScript">
function isitanumber(variable) {
if (variable/1 !== variable/1)
document.form.field.value = 'Error';
}
</SCRIPT>

It works with any number, integer or not. I assume it works because JavaScript doesn't know how to divide non-numbers. I used it to validate input entries into a random number generator I made.

Perhaps this will be useful . . .
--Russell Cottrell


Other feedback on 'Articles' - show all

  • Articles - Shen Lin 19:07:47 4/29/01
  • Articles - Russell Cottrell 12:49:21 2/15/01
  • Articles - Michael 21:46:25 8/24/00
  • Articles - Jennifer Wilde 17:19:44 3/14/00
  • Articles - Lloyd Gauthier 09:21:55 3/01/00
  • Articles - michael fewings 05:40:01 7/22/99
  • Articles - carl maton 03:17:57 6/03/99
  • Articles - Eric Garnel 14:31:10 5/25/99

Provide feedback ...
AddThis Social Bookmark Button

Provide feedback ... AddThis Social Bookmark Button


Last Updated: 6th July 2009. Maintained by: Martin Webb
irt.org liability, trademark, document use, privacy statement and software licensing rules apply.
Copyright © 1996-2009 irt.org, All Rights Reserved.