I need help!
I need that, after the user submits the form below, the email is validated, an alert is displayed and changes a part of the screen with the message "Welcome + email" for at least 5sec.
<form name="formcontact1" action="#">
<input type='text' name='email' size="36" placeholder="Your e-mail :)"/>
<input type="submit" name="submit" value="SUBMIT" onclick="ValidateEmail(document.formcontact1.email)" />
</form>
I have the following script to validate email that is working perfect!
function ValidateEmail(inputText) {
var mailformat = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;
if (inputText.value.match(mailformat)) {
alert("Email " + inputText.value + " has been sent");
document.getElementById('title1').innerHTML = 'Welcome ' + inputText.value;
return true;
}
else {
alert("Invalid Email");
document.formcontact1.email.focus();
return false;
}
}
After the button is clicked it shows the alert message "EMAIL xxx HAS BEEN SENT" (correct).
I need that it update part of the page with a message "WELCOME xxxxx".
The problem is after the alert message be shown. It update part of the page but reload. Is there a way to avoid this and keep 5 seconds before reload?. THANKS !!!