By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,848 Members | 3,202 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,848 IT Pros & Developers. It's quick & easy.

Interesting IE JScript support

P: 3
Anyone have any insight into why/how this amazingly works? Notice the dot notation in the function name. This will only work in IE. Interesting...

Expand|Select|Wrap|Line Numbers
  1. function MyFunction()
  2. {
  3. }
  4.  
  5. function MyFunction.MyFunction2()
  6. {
  7.     alert("worked!");
  8. }
  9.  
  10. MyFunction.MyFunction2(); //works!
  11.  
  12. //
  13.  
  14. function MyNonExistantFunction.MyFunction3()
  15. {
  16.     alert("will not work"); //MyNonExistantFunction not declared first
  17. }
  18.  
  19. MyNonExistantFunction.MyFunction3();
  20.  
Oct 1 '08 #1
Share this Question
Share on Google+
4 Replies


rnd me
Expert 100+
P: 427
this works in all browsers:

Expand|Select|Wrap|Line Numbers
  1.  
  2. function MyFunction()
  3. {
  4. }
  5.  
  6. MyFunction.MyFunction2=function ()
  7. {
  8.     alert("worked!");
  9. }
  10.  
  11. MyFunction.MyFunction2(); //works!
  12.  
  13.  
Oct 1 '08 #2

dmjpro
100+
P: 2,476
this works in all browsers:

Expand|Select|Wrap|Line Numbers
  1.  
  2. function MyFunction()
  3. {
  4. }
  5.  
  6. MyFunction.MyFunction2=function ()
  7. {
  8.     alert("worked!");
  9. }
  10.  
  11. MyFunction.MyFunction2(); //works!
  12.  
  13.  
Is there any difference between MyFunction.MyFunction2=function (){} and function MyFunction.MyFunction2(){}?
Oct 1 '08 #3

dmjpro
100+
P: 2,476
Anyone have any insight into why/how this amazingly works? Notice the dot notation in the function name. This will only work in IE. Interesting...
How much you gone through Function ?
Oct 1 '08 #4

rnd me
Expert 100+
P: 427
Is there any difference between MyFunction.MyFunction2=function (){} and function MyFunction.MyFunction2(){}?
yes, though very minor.

here is an elaboration.
Oct 1 '08 #5

Post your reply

Sign in to post your reply or Sign up for a free account.