Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head> To Do List
- <script>
- var list = [];
- function Add() {
- var adauga = document.getElementById('adauga');
- list.push(adauga.value);
- adauga.value = "";
- write();
- }
- function write() {
- var lista = document.getElementById('todolist');
- lista.innerHTML = "";
- for (i = 0; i < list.length; i++) {
- var newLi = document.createElement('li');
- newLi.innerHTML = '<input type="checkbox" onclick="check(' + i + ')" /> ' + list[i] + '<button onclick="delete(' + i + ')">Sterge</button>';
- lista.appendChild(newLi);
- }
- }
- function delete(i){
- list.splice(i, 1);
- write();
- }
- </script>
- </head>
- <body>
- <p>
- <button onclick="Add()" id="button">Add to list</button>
- </p>
- <ul id="todolist">
- <li> Scrie o lista</li>
- </ul>
- Lista
- <input type="text" id="adauga" name="haine">
- </br>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement