I\'m trying to make a pop up box, which gets invoked on clicking a button, this is what I\'ve got so far.. http://jsfiddle.net/WGPhG/2/
I've updated your Fiddle and made it work.
The changed HTML...
Updated JavaScript...
document.onreadystatechange = function () {
function popUp() {
var popup = document.createElement('div');
popup.className = 'popup';
popup.id = 'test';
popup.innerHTML = "This is a test message";
var cancel = document.createElement('div');
cancel.className = 'cancel';
cancel.onclick= function () { popup.destroy(); }
popup.appendChild(cancel);
document.body.appendChild(popup);
}
document.getElementById('popupButton').onclick = popUp;
}
Did this answer your question or is there anything else?
Update Improved the code and the fiddle. Now open and close works