0
var counter = 5;
var timer = setInterval(function () {
    seconds--;
    $('#regmsg').html('Successful! Message will close in ' + counter);
    if (counter == 0) {
        $.fancybox.close();
        parent.location.reload();
    }
}, 1000);
$.fancybox({
    href: '#regmsg',
    type: 'inline',
    'closeBtn': false
});

我想要时间显示,#regmsg但它只显示“成功!” 而不是消息的其余部分。问题是什么?我如何解决它?

4

1 回答 1

0

更改secondscounter

var counter = 5;
var timer = setInterval(function () {
    counter--; // <- here
    $('#regmsg').html('Successful! Message will close in ' + counter);
    if (counter == 0) {
        $.fancybox.close();
        parent.location.reload();
    }
}, 1000);

演示

于 2013-01-12T02:46:27.800 回答