jQuery doesn't use window=this in the way you are, jQuery uses:
(function() {
    var window = this;

)();

`this` inside of a function call like that is always the global object.

~Daniel Friesen (Dantman, Nadir-Seen-Fire) [http://nadir-seen-fire.com]
-Nadir-Point & Wiki-Tools (http://nadir-point.com) (http://wiki-tools.com)
-MonkeyScript (http://monkeyscript.org)
-Animepedia (http://anime.wikia.com)
-Narutopedia (http://naruto.wikia.com)
-Soul Eater Wiki (http://souleater.wikia.com)



tkinter wrote:
> I write a code like below to use "window=this", but it is wrong!!
>
> <html>
> <head><title>this example</title>
> <script language="Javascript" type="text/javascript">
> window=this;
> function dosomething(){
>         this.style.color="red";
>         }
>
>         window.onload=function(){ document.getElementById
> ("h").onclick=dosomething; }
> </script>
> </head>
>
> <body>
> <hl id="h">this example</h1>
> </body>
> </html>
>
> the right code is cancel the "window=this", why? why use the
> "window=this" in jquery source code???
>
> >
>   

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"jQuery Development" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/jquery-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to