Вот важная часть моего кода JS:
function createClose() {
var cButton = document.createElement("img");
cButton.src = "close.gif";
cButton.style.cursor = "pointer";
cButton.onclick = closeWindow;
document.getElementById("my_window").appendChild(cButton);
}
function closeWindow() {
document.getElementById("my_window").style.display = "none";
}
Изображение создается и добавляется, но при нажатии на него не вызывается событие onClick. Я также пытался использовать анонимную функцию, но это тоже не сработало.
Нет, я не собираюсь использовать jQuery (хотя я верю, что это проще).