Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!doctype html>
- <html lang="pl">
- <head>
- <title>Kontakt</title>
- <meta charset="utf-8">
- <link rel="stylesheet" href="styles.css">
- </head>
- <body>
- <h2 id="powitanie">Chciałbyś się skontaktować? Wyślij swoją wiadomość</h2>
- <form name="form" onsubmit="validate()">
- <label>
- Imię:
- <input type="text" name="imie" class="text" required/>
- </label>
- <label>
- Nazwisko:
- <input type="text" name="nazwisko" class="text" required/>
- </label>
- <label>
- Email:
- <input type="email" name="aemail" class="email" required/>
- </label>
- <label>
- Treść:
- <textarea name="pole" required></textarea>
- </label>
- <button type="submit">Wyślij wiadomość</button>
- </form>
- <script>
- function validate(){
- var ctrl = 0;
- if(document.form.imie.value.length < 3){
- alert("Niepoprawne imie");
- ctrl++;
- }
- if(document.form.nazwisko.value.length < 3){
- alert("Niepoprawne nazwisko");
- ctrl++;
- }
- if(document.form.aemail.value.length < 6){
- alert("Niepoprawny adres");
- ctrl++;
- }
- }
- if(document.form.pole.value.length == 0){
- alert("Uzupełnij wiadomość");
- ctrl++;
- }
- if(ctrl==4){
- alert("Wiadomość nie mogła zostać wysłana. Popraw formularz");
- }
- if(ctrl==0){
- alert("Wiadomość wysłana");
- }
- }
- </script>
- <article id="footer">
- <a href="index.html" title="powrot">Powrót</a>
- </article>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement