[php] me
Viewer
*** This page was generated with the meta tag "noindex, nofollow". This happened because you selected this option before saving or the system detected it as spam. This means that this page will never get into the search engines and the search bot will not crawl it. There is nothing to worry about, you can still share it with anyone.
- <?php
- $var = 'var myInput = document.getElementById("psw");
- var letter = document.getElementById("letter");
- var capital = document.getElementById("capital");
- var number = document.getElementById("number");
- var length = document.getElementById("length");
- // When the user clicks on the password field, show the message box
- myInput.onfocus = function() {
- document.getElementById("message").style.display = "block";
- }
- // When the user clicks outside of the password field, hide the message box
- myInput.onblur = function() {
- document.getElementById("message").style.display = "none";
- }
- // When the user starts to type something inside the password field
- myInput.onkeyup = function() {
- // Validate lowercase letters
- var lowerCaseLetters = /[a-z]/g;
- if(myInput.value.match(lowerCaseLetters)) {
- letter.classList.remove("invalid");
- letter.classList.add("valid");
- } else {
- letter.classList.remove("valid");
- letter.classList.add("invalid");
- }
- // Validate capital letters
- var upperCaseLetters = /[A-Z]/g;
- if(myInput.value.match(upperCaseLetters)) {
- capital.classList.remove("invalid");
- capital.classList.add("valid");
- } else {
- capital.classList.remove("valid");
- capital.classList.add("invalid");
- }
- // Validate numbers
- var numbers = /[0-9]/g;
- if(myInput.value.match(numbers)) {
- number.classList.remove("invalid");
- number.classList.add("valid");
- } else {
- number.classList.remove("valid");
- number.classList.add("invalid");
- }
- // Validate length
- if(myInput.value.length >= 8) {
- length.classList.remove("invalid");
- length.classList.add("valid");
- } else {
- length.classList.remove("valid");
- length.classList.add("invalid");
- }
- }';
Editor
You can edit this paste and save as new:
File Description
- me
- Paste Code
- 23 Jan-2022
- 1.74 Kb
You can Share it: