
I want to display the errors on the same form(Top of the form) after validation. I am used Div element and Table to display the error messages. It is working properly. But those error messages overlapping the existing contents which developed by the designer. There is a root Div element they are using for Window purpose. I tried to resize it using DOM. But the problem is still. Could you please provide me the reason or possible solutions for the issue?

<html>
<script>
function validate(){
var n=document.getElementById("name").value;
var a=document.getElementById("address").value;
if(n==""){
document.getElementById("lab").style.visibility="visible";
document.getElementById("lab").innerHTML="<font color=red>Enter Name!</font>";
return false;
}
if(a==""){
document.getElementById("lab").style.visibility="visible";
document.getElementById("lab").innerHTML="<font color=red>Enter Address</font>" ;
return false;
}
return true;
}
</script>
<form method="post" onsubmit="return validate();" action="">
<label id="lab" style="visibility:hidden;"></label>
<pre>
Enter Name: <input type="text" id="name"><br>
Enter Address: <input type="text" id="address"><br>
<input type="submit" value="Submit">
</pre>
</form>
</html>
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.