-
Hi,
I get an error in this function in IE 5.0, while they are run fine in NN4 and Opera5:
function check_number(numbertotest) {
var reg=RegExp("^[0-9]+$","");
return reg.test(numbertotest);
}
Any ideas what I am doing wrong ?
PS. The modification
var reg=RegExp('/^[0-9]+$/',"")
does not work either.
-
SitePoint Enthusiast
I don't know if this will work in IE 5.0... but I haven't heard any complains yet from my users who do.
I tend to keep my reg vars out of the quotes.
So mine looks like this...
var reg=/^[0-9]+$/;
And if you want to allow a blank entry, than just change the + to a *
Hope that helps.
Stuart Duncan
www.Logiforms.com
sales@logiforms.com
-
Thank you stuartd. It worked for me. I tried earlier
var reg=RegExp(/^[0-9]+$/,"");
but it failed too.
Best regards,
Chris
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
Bookmarks