Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE HTML>
- <html>
- <head>
- <meta charset='utf-8'>
- <title>Zadanko</title>
- </head>
- <body>
- <input type="text" id="haslo">
- <p id="zawartosc"></p>
- <input type="button" id="przycisk" value="Sprawdź">
- <script>
- function yeah(){
- haslo=document.getElementById("haslo").value;
- if(haslo.length==0){
- document.getElementById("zawartosc").style="color:red";
- document.getElementById("zawartosc").innerHTML="WPISZ HASŁO!";
- }
- else if(/[1-9]/.test(haslo) && (haslo.length>6)){
- document.getElementById("zawartosc").style="color:green";
- document.getElementById("zawartosc").innerHTML="DOBRE";
- }
- else if(/[1-9]/.test(haslo) && (haslo.length>3) && (haslo.length<7)){
- document.getElementById("zawartosc").style="color:blue";
- document.getElementById("zawartosc").innerHTML="ŚREDNIE";
- }
- else{
- document.getElementById("zawartosc").style="color:yellow";
- document.getElementById("zawartosc").innerHTML="SŁABE";
- }
- }
- document.getElementById("przycisk").addEventListener("click",yeah);
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement