Simple This.
4.11.2008
"This" is a JavaScript keyword that can be used to reference "self" or "me", instead of using a more complicated getElementById() method. It's handy for adding simple actions to elements using an inline action. In this example, putting a mouse cursor over each image below will enlarge it.
Here is the code for one of those images:
<img src="/images/code_imgs/buildings.png" alt="buildings" onmouseover="this.width='64';" onmouseout="this.width='32'" />
For more information on "this", take a look at quirksmode's explanation of the 'this' JavaScript keyword.
Permalink
Tags: code javascriptAuthorized users may log-in to leave a comment.




