mmm I see... Please, in the future use code tags when you post code to get more clear.
The problem is in the conditions. If you use OR, when one is true, returns ever true value. If you use AND, the two values should be true to execute the intrinsical methods.
Use complete headers with doctype, then use W3C validator. Note the use of getElementById, it is another method.
Also, you could split the ff1() in two functions, and call each condition in accordance with the id element if there are problems later.
<html>
<head>
<script>
function ff1()
{
if(document.getElementById('FirstName').value==""){
alert("Please enter your First Name");
document.getElementById('FirstName').focus();
}
if(document.getElementById('MotherTongue').value==""){
alert("Please enter your Mother Tongue");
document.getElementById('MotherTongue').focus()
}
}
</script>
</head>
<form method="post" action="validation.php">
Name :
<input name="FirstName" type="text" class="dropmenu" id="FirstName" value="First Name" size="15" maxlength="30" onblur="ff1()" />
<input name="LastName" type="text" class="dropmenu" id="LastName" value="Last Name" size="20" maxlength="30"/>
Mother Tongue :
<input name="MotherTongue" type="text" class="dropmenu" id="MotherTongue" value="Mother Tongue" size="20" maxlength="30" onblur="ff1()" />
<input name="submit" type="submit" class="button" value="submit" />
</form>
</html> martin5211
Posting Whiz in Training
271 posts since Aug 2007
Reputation Points: 52
Solved Threads: 23