Quite a number of errors observed, just to mention a few:
1. syntax error like equal comparison should "==" not "=",
2. regex error: why having an "*" towards the end of the re pattern, "*" means none or more, which means it will accept "10-10-20142012" as well as "10-10-"
Check out this example:
<!DOCTYPE html>
<html>
<body>
<form onsubmit="return validate();" action="">
Date of Birth: <input type="text" name="dob" value=""><br>
<input type="submit" value="Submit">
</form>
<script>
function validate()
{
var dob = document.forms[0].dob;
re = /^(\d{1,2})-(\d{1,2})-(\d{4})$/;
if((dob.value == "") || (!dob.value.match(re))) {
alert("Error:enter Valid date of birth!");
dob.focus();
dob.style.background = "yellow";
return false;
}
}
</script>
</body>
</html>