I've simplified your code for you and sped up your testing by using the regular expression "test()" method
$(document).ready(function(){ $('input#domain').keyup(function(){ var domain = $(this).val(); var reg = /^([a-z0-9]+(\-?\.?[a-z0-9]*)){2,63}\.([a-z]){2,4}$/i ; if (reg.test(domain)) { $("#ok").html("Correct format ..."); } else { $("#ok").html("Wrong format ...</p>"); } }); }); 2008/11/19 Jsbeginner <[EMAIL PROTECTED]>: > > > Hello, this is my first topic here, so I hope that I'm doing the right. I've > done a search on google and on this forum without finding anyone with the > same problem as me, but maybe I'm not looking for the right keywords. > > Here is my problem : I've created a very simple script that checks if a > domain is in a valid format or not, however with Firefox 3 it does not like > domains that are more than 20 characters long and firefox slows down and > then completly blocks. > > Here is my code : > > test.js : > function domchk() { > var domain = $("input#domain").val(); > var reg = /^([a-z0-9]+(\-?\.?[a-z0-9]*)){2,63}\.([a-z]){2,4}$/i ; > if (domain.match(reg)) { > $("#ok").html("Correct format ..."); > } else { > $("#ok").html("Wrong format ...</p>"); > } > } > > function simple_chk(target_items){ > $(target_items).each(function(){ > $(this).keyup(function(){ > domchk(); > }); > }); > } > > > $(document).ready(function(){ > simple_chk("input"); > }); > > > test.html : > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> > <html xmlns="http://www.w3.org/1999/xhtml"> > <head> > <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> > <title>Test page</title> > <script type="text/javascript" src="jquery-1.2.6.min.js"></script> > <script type="text/javascript" src="test.js"></script> > </head> > > <body> > <h1> Javascript domain check ...</h1> > <form> > <p> > <input id="domain" type="text" /></p> > <p id="ok">Not changed yet...</p> > </form> > </body> > </html> > > As you can see I've reduced the code to the bare minimum to make sure that > it was not another part of the code causing the problem, and also so that > you can maybe see the problem without having to read through lots of code. > This simplified version does exactly the same thing as the main one so the > problem is in the few lines of javascript. I've not includes the latest > stable version of jquery as I guess that you already have it... > > Thanks in advance :). > -- > View this message in context: > http://www.nabble.com/Firefox-problems-%28-with-input-reg.-exp.-verification%29.-tp20580852s27240p20580852.html > Sent from the jQuery General Discussion mailing list archive at Nabble.com. > > -- Rik Lomas http://rikrikrik.com