开发者

triggering multiple timed JavaScript functions onload

I've got a beautifully cheesy fireworks animation that I trigger onload using this code

<body onload="createFirewo开发者_开发技巧rk(50,1500,15,1,1,100,50,50,false,false); "> 

I want to trigger 3 instances of the fireworks 1 second apart onload, however I don't know the best method to achieve this.

Many thanks, Mike


To create a separate function where you will call createFirework 3 times. So you can play with params for each firework

<script>
  function createMyFirework(){
    createFirework(50,1500,15,1,1,100,50,50,false,false);
    createFirework(50,1500,15,1,1,100,50,50,false,false);
    createFirework(50,1500,15,1,1,100,50,50,false,false);
  }
</script>

<body onload="createMyFirework(); "> 
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜