I am using prototype;

TabbedInterface.prototype =
{
        init:function()
        {
                return this;
        },

.................


doMakeActive( this ); is between quotes as it needs to pass in the
object it is attached to, it will be attached to a list item <li> and
that is what it needs to pass in that function.

The problem is doMakeActive is a method of the object, but we don't
know what the reference name to the object is untill instantiation, if
I knew it before hand I could do myListItem.onclick =
"ReferenceName.doMakeActive( this );"


On 2/21/06, Steve Onnis <[EMAIL PROTECTED]> wrote:
>
> Try this
>
> doAddTab:function( linkText, source )
> {
>        var myListItem = document.createElement( "li" );
>        var myLink = document.createElement( "a" );
>        var myIFrame = document.createElement( "iframe" );
>        myLink.onclick = "return false;";
>        myLink.innerHTML = linkText;
>        myLink.href = "";
>        myListItem.onclick = function () {
>                doMakeActive( this );
>                }
>        return this;
> },
>
> That is ofcourse you have the doAddTab function associated with the rest of
> the object.
>
> Probably better to use prototypes for something like this
>
>
>
> -----Original Message-----
> From: cfaussie@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf
> Of Taco Fleur
> Sent: Tuesday, February 21, 2006 10:22 PM
> To: cfaussie@googlegroups.com
> Subject: [cfaussie] [OT] Reference to JS object
>
>
> I have a JS object with the following method;
>
> doAddTab:function( linkText, source )
> {
>        var myListItem = document.createElement( "li" );
>        var myLink = document.createElement( "a" );
>        var myIFrame = document.createElement( "iframe" );
>        myLink.onclick = "return false;";
>        myLink.innerHTML = linkText;
>        myLink.href = "";
>        myListItem.onclick = "doMakeActive( this );";
> ................
>        return this;
> },
>
> The problem is with myListItem.onclick = "doMakeActive( this );";
> as it should really have a reference to the object itself, eg.
> myListItem.onclick = "SomeObject.doMakeActive( this );";
>
> But ofcourse I don't know what SomeObject is until the object is
> instantiated like so;
> myObject = new SomeName().init();
>
> Does anyone know a way around this?
>
> --
> Taco Fleur - http://www.pacificfox.com.au
> Web Design, Web development, Graphic Design and Complete Internet Solutions
> an industry leader with commercial IT experience since 1994 .
>
>
>
>
>
>


--
Taco Fleur - http://www.pacificfox.com.au
Web Design, Web development, Graphic Design and Complete Internet Solutions
an industry leader with commercial IT experience since 1994 …

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"cfaussie" group.
To post to this group, send email to cfaussie@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cfaussie
-~----------~----~----~----~------~----~------~--~---

Reply via email to