Esempio ...
HTHcodice:<!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" xmlns:v="urn:schemas-microsoft-com:vml"> <head> <title>test</title> <script type="text/javascript"> function TestForBlank(str) { var re=/\s./; if(re.test(str)) { alert("non puoi scegliere una username con spazio"); return false; } return true; } </script> </head> <body> <form onsubmit="return TestForBlank(this.CampoNome.value);" method="GET"> <input type="text" name="CampoNome" /> <input type="submit" value="Vai" /> </form> </body> </html>
Zappa