开发者

How to open a popup AND make it flashing FROM the toolbar?

Just AS a chat (yahoomessenger, msn .开发者_JS百科....) WHEN we get a new message, the corresponding window is flashing

or AS in internet explorer WHEN we finsh downloading something the corresponding window is flashing in the toolbar

How to do it with a popup?


You can use the following javascript to trigger this.

window.focus();


That's not accessible from JavaScript in a web page. You could, however, change the title bar to a string such as "!!!!!!!!!!!!!!!!" and back again for a similar effect.

Example code (live at http://jsbin.com/ifewu3/2):

var oldTitle = '', titleBlanked = false, flashInterval;
flashInterval = setInterval(function () {
    if(!titleBlanked) {
        oldTitle = document.title;
        document.title = '!!!!!!!!!!!!!!!!';
        titleBlanked = true;
    } else {
        document.title = oldTitle;
        titleBlanked = false;
    }
}, 500);

Then call clearInterval(flashInterval) when you want to stop the flashing.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜