minsung

completet color change when validation failed

......@@ -40,28 +40,16 @@ function checkValidation(self){
}
function focusFunction(id) {
document.getElementById(id).focus();
}
$('#eValidation').keyup(function () {
var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
function blurFunction(id) {
document.getElementById(id).style.borderColor="2px solid";
document.getElementById(id).style.borderColor="red";
}
if (re.test($(this).val())) {
function validate(self){
var email=document.getElementById('eValidation').value;
var regExp = /^[0-9a-zA-Z]([-_.]?[0-9a-zA-Z])*@[0-9a-zA-Z]([-_.]?[0-9a-zA-Z])*.[a-zA-Z]{2,3}$/i;
var fpassword=document.getElementById('fValidation').value;
var spassword= document.getElementById('sValidation').value;
var x = document.getElementById(".inputset");
$(document).ready(function(){
if(regExp.test(email)){
return true;
}else if(email=""){
$(this).css("borderColor", "green");
return false;
}else return true;
} else {
});
}
$(this).css("borderColor", "red");
}
});
});
......
......@@ -10,6 +10,23 @@
</script>
<script src="https://cdn.jsdelivr.net/jquery.validation/1.16.0/jquery.validate.min.js">
</script>
<script type="text/javascript">
$(document).ready(function () {
$('#eValidation').keyup(function () {
var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
if (re.test($(this).val())) {
$(this).css("borderColor", "green");
} else {
$(this).css("borderColor", "red");
}
});
});
</script>
</head>
<body>
......@@ -37,7 +54,7 @@
<label for="password">비밀번호 확인:</label><br>
<input class="inputset" id="sValidation" type="password" name="checkpassword" placeholder="비밀번호를 입력하세요." ><br>
<span id='message'></span>
<label for="name">이름:</label><br>
<input class="inputset"type="text" name="name" placeholder="이름을 입력하세요." ><br>
......