[Project_owners] Javascript!
Matthew Wilson
matthew at mjwilson.demon.co.uk
Sun Oct 26 01:19:58 PDT 2008
When p.Initial is called, "this" does not refer to p, but "window".
See
https://developer.mozilla.org/en/DOM/element.addEventListener#The_value_of_this_within_the_handler
Matthew
joe ertaba wrote:
> Hi Matthew
>
> I dont think that this is a case , here is example:
>
> ----XUL---
> <label value="Put your XUL here!" id="iddd"
> onclick="
> * p.MyFuction();*
> "
> />
> -------
> ----JavaScript---
> var p = {
> element1 : "" ,
> Initial : function(){
> this.element1 = document.getElementById("iddd");
> },
> MyFuction : function(){
> this.element1.value="some text";
> }
> }
>
> *window.addEventListener("load", p.Initial, true); *
> -------
>
> In this example I use p.Initial in proper time, but still nothing
> happens when click on label!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.xul
Type: application/vnd.mozilla.xul+xml
Size: 540 bytes
Desc: not available
URL: <http://www.mozdev.org/pipermail/project_owners/attachments/20081026/70164da2/attachment.bin>
More information about the Project_owners
mailing list