基本的に私はこれをやっています:
window.onload=function wait(){
alert ("Please, wait until process has finished.");
window.location="index.jsp";
};
必要なのは、アラートウィンドウなど、X秒が経過した後にのみポップアップウィンドウの[OK]ボタンが消えたり有効になったりするものです。
これどうやってするの?
基本的に私はこれをやっています:
window.onload=function wait(){
alert ("Please, wait until process has finished.");
window.location="index.jsp";
};
必要なのは、アラートウィンドウなど、X秒が経過した後にのみポップアップウィンドウの[OK]ボタンが消えたり有効になったりするものです。
これどうやってするの?
多分あなたはこのようなものが必要です:
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);
}
}
jsFiddleでのデモ
var wait = function() {
alert ("Please, wait until process has finished.");
}
setTimeout(wait, 3000);
3000 は、関数を呼び出す前に待機するミリ秒です。
関数をsettimeoutに渡すだけです
setTimeout(yourfunction,2000);
これにより、ドキュメントの読み込みから 2 秒後に関数が実行されます