[thelist] Forms and getElementById

Andrew Clover and-evolt at doxdesk.com
Thu Jan 30 04:18:01 CST 2003


> var regexp = /([\w|\_]+\.?)*[\w|\_]@([\w|\_]+\.?)*[a-zA-Z]{2,3}$/;

That will cause a JS error on browsers that don't support regexp literals.
(eg. Opera 6). You could try a new Regexp() consturctor instead.

This is also not a good regexp for checking e-mail addresses. It allows
'_' in domain names, which DNS doesn't, and it doesn't allow '-' in
domain names or user names or '.' or '+' in user names. And it won't
allow .info and other TLDs. Note that \w also includes \_.

Best just check the address has a '@' in it. If people are going to
enter fake e-mail addresses they're going to do that anyway... the
more validity checking you add, the more likely it is you'll be
rejecting valid addresses.

> tag.style.visbility = "visible";

ahem. visibility

> <form id = "customer"
> <img id = "First_name"

Lose the spaces - <form id="customer" etc.

But, yeah, I'd change the IDs to be different to the input control names,
just for clarity's sake. It should still work with them being the same.

--
Andrew Clover
mailto:and at doxdesk.com
http://www.doxdesk.com/



More information about the thelist mailing list