Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <div id="modal-window">
- <div class="form-wrapper">
- <form action="">
- <div id="authorList"><label>Количество авторов</label>
- <select id="number-of-authors" name="number-of-authors" onchange="runSelect()">
- <option value="1" > 1 автор </option>
- <option value="2"> 2 автори </option>
- <option value="7"> от 3 до 7 авторов </option>
- <option value="more-then-8"> больше 8 авторов </option>
- <option value="organisation"> Автор неизвестен або колективный автор (учереждение) </option>
- </select></br></br>
- </div>
- </form>
- const authorNameLabel = document.createElement('div');
- authorNameLabel.innerHTML = '<lable for="main-name">Фамилия автора</lable> <input name="main-name" id="main-name"/><lable> Инициалы</lable> <input /> </br></br>'
- function runSelect() {
- const numberOfAuthors = document.querySelector('#number-of-authors').value;
- switch (numberOfAuthors) {
- case '1': authorList.appendChild(authorNameLabel);
- authorList.appendChild(authorNameLabel);
- break;
- case '2': authorList.appendChild(authorNameLabel);
- authorList.appendChild(authorNameLabel);
- authorList.appendChild(authorNameLabel);
- break;
- case '7': for (let i = 0; i < 7; i++) {
- authorList.appendChild(authorNameLabel);
- }
- break;
- case 'more-then-8': for (let i = 0; i < 6; i++) {
- authorList.appendChild(authorNameLabel);
- }
- authorNameLabel.innerHTML = '<lable for="main-name">Фамилия ПОСЛЕДНЕГО автора</lable> <input name="main-name" id="main-name"/><lable> Инициалы</lable> <input /> </br></br>'
- authorList.appendChild(authorNameLabel);
- case 'organisation': authorNameLabel.innerHTML = '<lable for="main-name">Название организации, учреждения, что подготовила монографию <input name="main-name" id="main-name"/> </br></br>'
- authorList.appendChild(authorNameLabel);
- break;
- }
- }
Add Comment
Please, Sign In to add comment