[Project_owners] Javascript!

joe ertaba belaviyo at gmail.com
Sat Oct 25 08:17:12 PDT 2008


Hi Roberto

Thanks for response ;

var p = {
    element1 : "" ,
    ....
    Initial : function(){
        this.element1 = document.getElementById('some id');
    },
    ....
    MyFuction : function(){
        this.element1.value="some text";
    }
}

p.Initial();
p.MyFuction();

but it doesn't works too [?]
Any idea ?





On Sat, Oct 25, 2008 at 7:00 PM, Roberto Bouzout (tito) <zilla at nxuy.com>wrote:

> var p = {
>> element1 : document.getElementById('some id') ,
>> ....
>>
>> MyFuction : function(){
>>
>> element1.value="some text";
>> },
>>
>>
>> }
>>
>
> Properties of "p" from the "inside" are accessed by "this" keyword
> I think that this should work, but maybe there is another problem such
> document.getElementById('some id') is not defined when "p" is initialized.
>  MyFuction : function(){
>   this.element1.value="some text";
>  },
>
> _______________________________________________
> Project_owners mailing list
> Project_owners at mozdev.org
> https://www.mozdev.org/mailman/listinfo/project_owners
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.mozdev.org/pipermail/project_owners/attachments/20081025/a441ad72/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/png
Size: 605 bytes
Desc: not available
URL: <http://www.mozdev.org/pipermail/project_owners/attachments/20081025/a441ad72/attachment.png>


More information about the Project_owners mailing list