Guest User

Untitled

a guest
Sep 23rd, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.18 KB | None | 0 0
  1. <div id="modal-window">
  2. <div class="form-wrapper">
  3. <form action="">
  4. <div id="authorList"><label>Количество авторов</label>
  5. <select id="number-of-authors" name="number-of-authors" onchange="runSelect()">
  6. <option value="1" > 1 автор </option>
  7. <option value="2"> 2 автори </option>
  8. <option value="7"> от 3 до 7 авторов </option>
  9. <option value="more-then-8"> больше 8 авторов </option>
  10. <option value="organisation"> Автор неизвестен або колективный автор (учереждение) </option>
  11. </select></br></br>
  12. </div>
  13. </form>
  14.  
  15. const authorNameLabel = document.createElement('div');
  16. authorNameLabel.innerHTML = '<lable for="main-name">Фамилия автора</lable> <input name="main-name" id="main-name"/><lable> Инициалы</lable> <input /> </br></br>'
  17. function runSelect() {
  18. const numberOfAuthors = document.querySelector('#number-of-authors').value;
  19. switch (numberOfAuthors) {
  20. case '1': authorList.appendChild(authorNameLabel);
  21. authorList.appendChild(authorNameLabel);
  22. break;
  23. case '2': authorList.appendChild(authorNameLabel);
  24. authorList.appendChild(authorNameLabel);
  25. authorList.appendChild(authorNameLabel);
  26. break;
  27. case '7': for (let i = 0; i < 7; i++) {
  28. authorList.appendChild(authorNameLabel);
  29. }
  30. break;
  31. case 'more-then-8': for (let i = 0; i < 6; i++) {
  32. authorList.appendChild(authorNameLabel);
  33. }
  34. authorNameLabel.innerHTML = '<lable for="main-name">Фамилия ПОСЛЕДНЕГО автора</lable> <input name="main-name" id="main-name"/><lable> Инициалы</lable> <input /> </br></br>'
  35. authorList.appendChild(authorNameLabel);
  36. case 'organisation': authorNameLabel.innerHTML = '<lable for="main-name">Название организации, учреждения, что подготовила монографию <input name="main-name" id="main-name"/> </br></br>'
  37. authorList.appendChild(authorNameLabel);
  38. break;
  39. }
  40. }
Add Comment
Please, Sign In to add comment