HOw can I have a Alert message in a div inside the form

Posted by Paromita Poddar on Stack Overflow See other posts from Stack Overflow or by Paromita Poddar
Published on 2012-06-06T16:37:55Z Indexed on 2012/06/06 16:40 UTC
Read the original article Hit count: 196

Filed under:
|
|
|

I have this script and it sends out an alert message. All I want is to put the alert message in a div inside the form. here is the script can you please help asap

`

var registered=false

function ExamineRegistration()
{
var email =document.regform.email.value;
var emailcheck= email.indexOf("@")
var emailcheck2= email.indexOf(".")
var password = document.regform.pass.value;
var passcheck = password.charAt(0)
var message_out = "Errors: "

if(email=="" || password==""){
message_out = message_out+"All boxes should be filled in, "
}

if(emailcheck==-1 || emailcheck2==-1)
{
message_out = message_out+"email must contain @ and ., "
}

if(password!=password)
{
message_out=message_out+"password must match"
}

if(message_out == "Errors: ") {
    message_out = "You have successfully been logged in!"
    registered=true
}

alert(message_out);
}
--> This function helps the user first to register and than to enter the site.
function Checkreg() {
if (registered ==true) {
location.replace("http://www.google.com")
}
else alert("Please Login to proceed")
}
</script>

`

I have a form. I just want the alert message to appear inside the form at the top. I just dont know how to display the alert message inside the form instead of a pop up.

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery