我想在我的剧本中延迟3秒钟
但是我怎么能这样做,我不知道!
我的剧本:
<script type="text/javascript"> var baslik = document.title; $(document).ready(function () { document.title = '(Welcome)' + baslik; // After 3 seconds document.title = '(What can i do for you ?)' + baslik; // After 3 seconds document.title = '(Thank u for viewing to me)' + baslik; // After 3 seconds document.title = baslik; }); </script>
解决方法
使用超时
http://www.w3schools.com/jsref/met_win_settimeout.asp
var baslik = document.title; postMsg = function(txt) { document.title = txt + baslik; } $(document).ready(function(){ setTimeout("postMsg('(Welcome)')",3000); setTimeout("postMsg('(What can i do for you ?)')",6000); setTimeout("postMsg('(Thank u for viewing to me)')",9000); });