in reply to Onkeyup not working

I agree with what Corion said that you should use a templating system such as Mojo::Template, especially given your reply further down in the thread.

But you should also look into new HTML5 <input type="email">.

And don't rely on any validation that may have been done in the browser because it is very easy to bypass. Always validate on the server side. See How do I check a valid mail address.