edensan
edensan

Reputation: 1

try to blank out the screen after negative confirmtation

hi I want to blank out (better was close but window.cose doesn't work any more) the screen after a negative confirmation.

I have the following script:

<script type="text/javascript">

function blankIt ()
{
    document.write ("");
    document.close ();
}

var elems = document.getElementsByClassName('confirmation');
var confirmIt = function (e) {
    if (!confirm('Are you sure?')) e.preventDefault();
};

for (var i = 0, l = elems.length; i < l; i++) {
    elems[i].addEventListener('click', confirmIt, false);
}

var confirmIt = function (f) {
    if (!confirm('Are you sure?')) f.preventDefault();
};

for (var i = 1, l = elems.length; i < l; i++) {
    elems[i].addEventListener('click', blankIt, false);
}
</script>

I have really no clue. Maybe someone can point me the right direction

thx in advance

greetz edensan

Upvotes: 0

Views: 29

Answers (1)

masch
masch

Reputation: 594

document.write() inserts/appends something to the DOM. It does not alter existing content.

document.body.innerHTML = ''; should work as expected.

Upvotes: 0

Related Questions