Hi all.
This code javascript not working... nothing error but not working... :(
I need change color in the fields of the form when fields is null...
My code:
This code javascript not working... nothing error but not working... :(
I need change color in the fields of the form when fields is null...
My code:
Code:
function validateForm(Qform)
{
for (var a = 0; a < Qform.elements.length; a++)
{
var field = Qform.elements[a];
var incorrect = new Array();
var no = 0;
if (field.value.length <= 0)
{
window.alert('K.O. !');
field.focus();
return false;
} else {
incorrect[no] = "1";
no++;
}
}
for(j=0;j<no;j++) {
document.getElementById(incorrect[j]).style.color="#FF0000";
}
....
<form action="" method="post" onSubmit="validateForm();">
<span id="1">Title </span>
<input name="id" id="title" type="text" size="25" maxlength="6">
....
Comment