I have bthis function i use to validate data in an input field.
Code:
validateFunctions["float"] = function(id)
{
sender = document.getElementById(id);
if ((sender.value != '') && !(/^\s*\d+([\.,]\d+)?\s*$/g).test(sender.value))
{
sender.style.backgroundColor = 'red';
setTimeout("document.getElementById('"+id+"').style.backgroundColor = 'white';",400);
return false;
}
};
It generally works, the problem is, while in IE the value with "," (for example "4,1") doesn't cause any problems, it is "flashed" invalid in Firefox.
What's up with FFox's regexp engine? O r is it IE bug combined with wrong regexp?
|