The problem is that the only code you have (checkPass) does not execute when hitting submit button...
One of the options you have is add some code to checkPass that will enable disable the submit button.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Untitled Page</title>
</head>
<body>
<form id="register" method="post" action="finish.html">
Set Password * :
<input type="password" id="setpassword" required="required">
Confirm Password * :
<input type="password" id="confirm" required="required" onkeyup="checkPass();" /><span
id="message2" class="message2"></span>
<input type="submit" id="submit" disabled="disabled">
</form>
<script type="text/ecmascript">
function checkPass() {
var pass1 = document.getElementById('setpassword');
var pass2 = document.getElementById('confirm');
var btn = document.getElementById('submit');
var message = document.getElementById('message2');
var goodColor = "#0C6";
var badColor = "#FF9B37";
if (pass1.value == pass2.value) {
pass2.style.backgroundColor = goodColor;
message.style.color = goodColor;
message.innerHTML = "Matching!"
btn.disabled = false;
return true;
} else {
pass2.style.backgroundColor = badColor;
message.style.color = badColor;
message.innerHTML = "Doesn't Matching!"
btn.disabled = true;
return false;
}
}
</script>
</body>
</html>