20 February 2012

Confirmation before window closes

The script below is to display to us a confirmation button(ok/cancel) before windows really closed.


    <script type="text/javascript">
           window.onbeforeunload = function(evt) {
            var message = 'Apakah anda yakin menutup laman ini?';
            if (typeof evt == 'undefined') {
                evt = window.event;
            }
            if (evt) {
                evt.returnValue = message;
            }
            return message;
        }
    <script>

No comments:

Post a Comment

Twiit.. Twiit... Gulp