Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE HTML>
- <html lang="pl">
- <head>
- <meta charset="utf-8" />
- <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
- <title></title>
- </head>
- <body>
- <script>
- var pin = /^[A-Z][a-z]+\s[A-Z][a-z]+$/;
- var pk = /^[0-9]{2}-[0-9]{3}$/;
- var pe = /^[a-z0-9]+@gmail.com$/;
- var im = "";
- var ko ="";
- var ma = "";
- function f(){
- var imieinazwisko = document.getElementById("imieinazwisko").value;
- var kod = document.getElementById("kod").value;
- var mail = document.getElementById("mail").value;
- if (pin.test(imieinazwisko)){
- im = "poprawne";
- }
- else{
- im = "błedne";
- }
- if (pk.test(kod)){
- ko = "poprawny";
- }
- else{
- ko = "błedny";
- }
- if (pe.test(mail)){
- ma = "poprawny";
- }
- else{
- ma = "błędny";
- }
- alert("Imie i nazwisko: "+im+"\n"+"Kod pocztowy: "+ko+"\n"+"Email w domenie @gmail.com: "+ma+"\n");
- }
- </script>
- <form>
- <label for="imieinazwisko">Imie i nazwisko:</label><br>
- <input type="text" id="imieinazwisko" name="imieinazwisko"><br>
- <label for="kod">Kod Pocztowy:</label><br>
- <input type="text" id="kod" name="kod"><br>
- <label for="mail">Email w domenie @gmail.com:</label><br>
- <input type="text" id="mail" name="mail"><br>
- </form>
- <br><button type="button" onclick="f()">KLIK</button>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement