Re: 答复: [Proto-Scripty] Re: problem in Event.observe()

2011-06-09 Thread Richard Quadling
On 8 June 2011 14:31, ColinFine colin.f...@pace.com wrote:


 On Jun 7, 8:05 am, 操坤 madfro...@gmail.com wrote:
 Hi:
         Sorry for my poor English  :P
         I know your meaning of your reply:

 I did a simple test:

         test=function(){
                 alert(11);
         }
         Event.observe(window,load,test);

 The above is correct.

         function test2(){
                 alert(2);
         }
         Event.observe(window,load,test2());

 The above is wrong.

I think

 Event.observe(window,load,test2);

would be OK too.

-- 
Richard Quadling
Twitter : EE : Zend : PHPDoc
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY : bit.ly/lFnVea

-- 
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.



Re: 答复: [Proto-Scripty] Re: problem in Event.observe()

2011-06-08 Thread ColinFine


On Jun 7, 8:05 am, 操坤 madfro...@gmail.com wrote:
 Hi:
 Sorry for my poor English  :P
 I know your meaning of your reply:

 I did a simple test:

 test=function(){
 alert(11);
 }
 Event.observe(window,load,test);

The above is correct.

 function test2(){
 alert(2);
 }
 Event.observe(window,load,test2());

The above is wrong.

-- 
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.



答复: [Proto-Scripty] Re: problem in Event.observe()

2011-06-07 Thread 操坤
Hi:
Sorry for my poor English  :P
I know your meaning of your reply:

I did a simple test:

test=function(){
alert(11);
}
Event.observe(window,load,test);

function test2(){
alert(2);
}
Event.observe(window,load,test2());

The code run successful in ie, but it allways warn me contents error,and
maybe prevent other coding to run after.
It confuse me a lot.

Thanks for your help,by heart!
Quentin CK



-邮件原件-
发件人: prototype-scriptaculous@googlegroups.com
[mailto:prototype-scriptaculous@googlegroups.com] 代表 T.J. Crowder
发送时间: 2011年6月4日 18:28
收件人: Prototype  script.aculo.us
主题: [Proto-Scripty] Re: problem in Event.observe()

Hi,

This group works in English, so please translate any other languages
when quoting. According to Google, that translates as:
* * * *
Error details page

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64;
Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR
3.0.30729; InfoPath.2; .NET4.0C)
Timestamp: Fri, 3 Jun 2011 09:17:26 UTC

Message: Missing Objects
Line: 3863
Character: 5
Code: 0
* * * *

 Event.observe(window,'load',test());

 every thing is ok in firefox or chrome ,but in ie8 ,an error occured
 like this

It seems unlikely that it works in Firefox or Chrome, because your
#observe call is incorrect. You're *calling* the `test` function and
passing its return value into `observe`. Since your `test` function
doesn't return anything, the result of calling it is `undefined`.

Instead, just pass a reference to your `test` function into `observe`,
without calling `test`:

Event.observe(window,'load',test);
//  ^--- No () here

我希望这有助于 ;-)
--
T.J. Crowder
Independent Software Engineer
tj / crowder software / com
www / crowder software / com

On Jun 3, 10:22 am, 坤 操 madfro...@gmail.com wrote:
 function test(){
 alert('adfsasdfdsaf');}

 Event.observe(window,'load',test());

 every thing is ok in firefox or chrome ,but in ie8 ,an error occured
 like this

 网页错误详细信息

 用户代理: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64;
 Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR
 3.0.30729; InfoPath.2; .NET4.0C)
 时间戳: Fri, 3 Jun 2011 09:17:26 UTC

 消息: 缺少对象
 行: 3863
 字符: 5
 代码: 0
 URI:http://vmck.com.cn/Windchill/netmarkets/javascript/util/prototype.js

-- 
You received this message because you are subscribed to the Google Groups
Prototype  script.aculo.us group.
To post to this group, send email to
prototype-scriptaculous@googlegroups.com.
To unsubscribe from this group, send email to
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/prototype-scriptaculous?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.



[Proto-Scripty] Re: problem in Event.observe()

2011-06-04 Thread T.J. Crowder
Hi,

This group works in English, so please translate any other languages
when quoting. According to Google, that translates as:
* * * *
Error details page

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64;
Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR
3.0.30729; InfoPath.2; .NET4.0C)
Timestamp: Fri, 3 Jun 2011 09:17:26 UTC

Message: Missing Objects
Line: 3863
Character: 5
Code: 0
* * * *

 Event.observe(window,'load',test());

 every thing is ok in firefox or chrome ,but in ie8 ,an error occured
 like this

It seems unlikely that it works in Firefox or Chrome, because your
#observe call is incorrect. You're *calling* the `test` function and
passing its return value into `observe`. Since your `test` function
doesn't return anything, the result of calling it is `undefined`.

Instead, just pass a reference to your `test` function into `observe`,
without calling `test`:

Event.observe(window,'load',test);
//  ^--- No () here

我希望这有助于 ;-)
--
T.J. Crowder
Independent Software Engineer
tj / crowder software / com
www / crowder software / com

On Jun 3, 10:22 am, 坤 操 madfro...@gmail.com wrote:
 function test(){
 alert('adfsasdfdsaf');}

 Event.observe(window,'load',test());

 every thing is ok in firefox or chrome ,but in ie8 ,an error occured
 like this

 网页错误详细信息

 用户代理: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64;
 Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR
 3.0.30729; InfoPath.2; .NET4.0C)
 时间戳: Fri, 3 Jun 2011 09:17:26 UTC

 消息: 缺少对象
 行: 3863
 字符: 5
 代码: 0
 URI:http://vmck.com.cn/Windchill/netmarkets/javascript/util/prototype.js

-- 
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.