29 lines
1.0 KiB
HTML
29 lines
1.0 KiB
HTML
|
<html>
|
||
|
<head>
|
||
|
<title>Example 6.12</title>
|
||
|
<script>
|
||
|
function getPasswordInfo(pword)
|
||
|
{
|
||
|
var pwordSize = 0; var userWord = " "; var wordLength = 0;
|
||
|
pwordSize = document.getElementById(pword).size;
|
||
|
document.getElementById('field_size').innerHTML = pwordSize;
|
||
|
userWord = document.getElementById(pword).value;
|
||
|
document.getElementById('pword').innerHTML = userWord;
|
||
|
wordLength = userWord.length;
|
||
|
document.getElementById('word_size').innerHTML = wordLength;
|
||
|
}
|
||
|
</script>
|
||
|
</head>
|
||
|
|
||
|
<body>
|
||
|
<table width = 60% align = "center"><tr><td><br />
|
||
|
<h2> Enter a password that is between 4 and 8 characters, using only digits (0 - 9) and letters. </h2>
|
||
|
<p><input type="password" name="user_pwrd" id="passwrd" size = ""/>
|
||
|
<input type ="button" onclick="getPasswordInfo('passwrd')" value = "ok"></button></p>
|
||
|
<p>Password information:<br />
|
||
|
Number characters allowed: <span id = "field_size"> </span> <br />
|
||
|
Number characters entered: <span id = "word_size"> </span> <br />
|
||
|
Password entered: <span id = "pword"> </span> </p>
|
||
|
</td></tr></table>
|
||
|
</body></html>
|