Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>Imena prezimena i godine</title>
- </head>
- <body>
- <form id="form">
- <label>IME:</label>
- <input type="text" id="ime"><br><br>
- <label>PREZIME:</label>
- <input type="text" id="prezime"><br><br><br>
- <label>GODINE:</label>
- <input type="number" id="godine"><br><br>
- <button type="button" id="kreiraj">Ispisi ime</button> <br>
- <textarea id="spisak" cols="100" rows="30"></textarea>
- </form>
- <script>
- let ime = document.getElementById("ime");
- let prezime = document.getElementById("prezime");
- let godine = document.getElementById("godine")
- let kreiraj = document.getElementById("kreiraj");
- let spisak = document.getElementById("spisak");
- function dodajIspis(){
- let ispis = "Vi ste " + ime.value + " " + prezime.value + " i imate " + godine.value + " godina" ;
- spisak.value += ispis + "\n";
- ime.value = "";
- prezime.value = "";
- }
- kreiraj.addEventListener("click", dodajIspis);
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement