我有这个脚本,它会发出一条警报消息。我想要的只是将警报消息放在表单内的 div 中。这是脚本:
<script type="text/javascript">
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>
我有一个表格。我只希望警报消息出现在顶部的表单中。我只是不知道如何在表单中显示警报消息而不是弹出窗口。