admin管理员组文章数量:1290957
Basically I'm doing this:
window.onload=function wait(){
alert ("Please, wait until process has finished.");
window.location="index.jsp";
};
What I need is, an alert window, or something similar that will disappear/enable the "OK" button in the popup window, only after X seconds are passed.
How can I do this?
Basically I'm doing this:
window.onload=function wait(){
alert ("Please, wait until process has finished.");
window.location="index.jsp";
};
What I need is, an alert window, or something similar that will disappear/enable the "OK" button in the popup window, only after X seconds are passed.
How can I do this?
Share Improve this question asked Feb 7, 2013 at 9:06 abiertoabierto 1,4677 gold badges29 silver badges61 bronze badges3 Answers
Reset to default 5Maybe you need something like this:
window.onload = function () {
var popup = window.open('','pop','width=200px, height=10px'),
popdoc, msg, script;
if (popup) {
popdoc = popup.document;
msg = popdoc.body.appendChild(popdoc.createElement('p'));
msg.innerHTML = 'Please, wait until process has finished.';
script = popdoc.createElement('script');
script.text = '(function () {setTimeout(function () {self.close();}, 3000);}());';
popdoc.body.appendChild(script);
}
}
A demo at jsFiddle
var wait = function() {
alert ("Please, wait until process has finished.");
}
setTimeout(wait, 3000);
The 3000 is the miliseconds you want to wait before it calls the function.
just pass the function to the the settimeout
setTimeout(yourfunction,2000);
this will run the function after 2 sec of the doc load
本文标签: Wait popup window javascriptStack Overflow
版权声明:本文标题:Wait popup window javascript - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741522870a2383292.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论