как на онклик повесить событие по созданию кнопки
var library = document.createElement('div');
library.style.width = '300px'; library.style.height = '600px'; library.style.backgroundColor = '#FFFACD'; library.style.position = 'absolute'; library.style.border = '2px solid'; document.body.appendChild(library); var button = document.createElement('input'); button.type = 'button'; button.value = 'button'; button.style.position = 'absolute'; button.style.top = 100; button.style.left = 100; library.appendChild(button); var button2 = document.createElement('input'); button2.type = 'text'; button2.value = 'textbox'; button2.style.position = 'absolute'; button2.style.top = 150; button2.style.left = 55; library.appendChild(button2); var button3 = document.createElement('input'); button3.type = 'checkbox'; button3.value = 'check'; button3.style.position = 'absolute'; button3.style.top = 200; button3.style.left = 110; library.appendChild(button3); var button4 = document.createElement('input'); button4.type = 'radio'; button4.value = 'radio'; button4.style.position = 'absolute'; button4.style.top = 250; button4.style.left = 110; library.appendChild(button4); var button5 = document.createElement('input'); button5.type = 'time'; button5.value = 'radio'; button5.style.position = 'absolute'; button5.style.top = 300; button5.style.left = 85; library.appendChild(button5); var button6 = document.createElement('input'); button6.type = 'date'; button6.value = 'radio'; button6.style.position = 'absolute'; button6.style.top = 350; button6.style.left = 55; library.appendChild(button6); var content = document.createElement('div'); content.style.width = '1000px'; content.style.height = '600px'; content.style.left = '300px'; content.style.backgroundColor = '#FAAACD'; content.style.position = 'absolute'; content.style.border = '2px solid'; document.body.appendChild(content); button.onclick = function abc(event) { var button11 = createElement('input'); button11.type = 'button'; button11.value = 'button'; button11.style.position = 'relative'; button11.style.top = 100; button11.style.left = 100; content.appendChild(button11); } Задача какая, в левой части экрана в отдельном слое лежат разные кнопки, нужно чтобы по нажатию на какую-нибудь из них в соседнем слое в случайном месте появлялась такая же кнопка и ей можно было бы управлять или через онкейдаун или драг-анд-дроп. Помогите, пожалуйста, не могу на онклик повесить чтобы в соседнем слое кнопка создавалась такая же. |
Цитата:
|
Rise, судя по коду автор наркоман
|
Часовой пояс GMT +3, время: 03:00. |