开发者

javascript how to use smoke.js with onbeforeunload?

i am using smoke.js to create some neat alerts :)

the problem comes when i try to use it on the onbeforeunload event.

i place it like this:

<body onbeforeu开发者_开发百科nload="javascript:tstconfirm();">

but looks like the script gets unloaded or something because the script doesn't work.

if i try:

<body onbeforeunload="javascript:alert('test');">

the alert works.

any ideas on how to fix this ?

thanks


fixed.

<script language="JavaScript">
$(function() {
$(window).bind('beforeunload', function() {
    setTimeout(function() {
        setTimeout(function() {
           $(".black").css('display', 'block');
         // or do something else
        }, 1000);
    },1);
    return 'Wait! Save up to $20 Today!';
});
});
</script>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜