你好, 你可以为ready事件定义多个函数。也就是你那样写是可以的。 至于你说的合在一起和分开是有区别的,至少我亲身体验的是我是能合在一起就合在一起,需要分开就不得不分开。 不过分开写的时候,最好每个函数彼此之间不要相互依赖。
Xinhao Zheng SGL中文Blog: http://blog.cjcht.com SGL中文文档: http://wiki.cjcht.com SGL中文Group:http://groups.google.com/group/seagull_forum 2008/9/21 立体风 <[EMAIL PROTECTED]> > 不好意思,英语不好见笑了,我实际是想问问: > 放在$(document).ready(x)中的函数多少有限制吗?比如: > $(document).ready(function(){ > a(); > b(); > c(); > }); > 上面是放了3个函数,如果这样写: > $(document).ready(function(){ > a(); > }); > $(document).ready(function(){ > b(); > }); > $(document).ready(function(){ > c(); > }); > 在这里a(); b(); c();是jquery的一个效果或事件,和到一起和分开有区别吗? > 谢谢! > > > > > > 2008/9/18 ~flow <[EMAIL PROTECTED]> > > >> 敬請原諒但是詢問文字上大概有點儿不太清楚。 >> >> `$(document).ready(x)` 裏面可以放个function,然後browser使發該event時這个function將被執行。 >> 如果document已經完成的時候script說`$(document).ready(x)`的話,那它的引數`x`立即被execute。 >> >> 一个document ready的引數function可以有多少clauses,也可以在一个script裏面define多少document >> ready,它們紛紛都將被執行。 >> >> 例。$(document).ready(function(){alert('helo')}) >> >> 以上。 >> >> On Sep 18, 1:43 pm, "立体风" <[EMAIL PROTECTED]> wrote: >> > Hello all, >> > Why sometimes with time, and sometimes "$(document).ready()" with many >> > times? >> > >