2014. 5. 29. 15:33

[자바스크립트][예제] 간단한 password 체크 프로그램

=> 아주 간단한 예제, 예외처리 해서 써야 하는 부분들은 많지만, 간단히 password체크 해 볼 수 있다!






<html>

<head>

<script language="javascript">

function passwordCheckk()

{

var password = document.getElementById("password").value;

var passwordCheck = document.getElementById("passwordCheck").value;


if ( passwordCheck == "")

                        {  

                               document.getElementById("passwordCheckText").innerHTML = "" } 

                         else if ( password != passwordCheck )

{

document.getElementById("passwordCheckText").innerHTML = "<b><font color=red size=5pt> Not Ok PW. </font></b>"

}

else

{

document.getElementById("passwordCheckText").innerHTML = "<b><font color=red size=5pt> Ok PW. </font></b>"

}

}

</script>

</head>

<body>

<table border=1>

<tr style="border-left-style:dashed;border-right-style:dashed">

<td>

패스워드

</td>

<td colspan="2">

<input type="password" id="password" name="pw"><br>

</td>

</tr>

<tr style="border-left-style:dashed;border-right-style:dashed">

<td>

패스워드체크

</td>

<td>

<input type="password" id="passwordCheck" name="pw" onkeyup="passwordCheckk()"><br>

</td>

<td id="passwordCheckText" width=100>

</td>

</tr>

</table>

</body>

</html>





Posted by Triany