<head> <script type="text/javascript"> function sleep(time, callback) { setTimeout(callback, time); } </script> </head> <body> <h1>Timeout</h1> setTimeout() を使って sleep() 関数を作成します。<br> <script type="text/javascript"> sleep(300, function (){ alert(300); } ); sleep(100, function (){ alert(100); } ); sleep(250, function (){ alert(250); } ); sleep(150, function (){ alert(150); } ); </script> |