You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Peter Kanze <pe...@gmail.com> on 2009/03/27 19:35:04 UTC

T5: Prototype question

Hello
Why is this working:
if (element.up().id == 'tab4')
      element.addClassName('active');

And this not:
if (element.up().id == this.activeTabId) {
    element.addClassName('active');

And this.activeTabId = tab4

See here the full javascript code:

var ActiveStyle = Class.create();
ActiveStyle.prototype = {
initialize : function(element, activeTabId) {
this.activeTabId = activeTabId;
this.panelLinks = $('tabset').select('a');
Event.observe($(element), 'click', this.doConfirm
.bindAsEventListener(this));
},
doConfirm : function(e) {
this.panelLinks.each(function (element)
{
if (element.up().id == 'tab4') {
element.addClassName('active');
}else {
element.removeClassName('active');
}
})
}
}

Re: T5: Prototype question

Posted by Peter Kanze <pe...@gmail.com>.
Hello

Yes indeed,

this.activeTabId = 'tab4'



On Fri, Mar 27, 2009 at 10:12 PM, Howard Lewis Ship <hl...@gmail.com>wrote:

> Do you mean:
>
> this.activeTabId = 'tab4'
>
> ?
>
> If not, there's your answer.
>
> On Fri, Mar 27, 2009 at 11:35 AM, Peter Kanze <pe...@gmail.com>
> wrote:
> > Hello
> > Why is this working:
> > if (element.up().id == 'tab4')
> >      element.addClassName('active');
> >
> > And this not:
> > if (element.up().id == this.activeTabId) {
> >    element.addClassName('active');
> >
> > And this.activeTabId = tab4
> >
> > See here the full javascript code:
> >
> > var ActiveStyle = Class.create();
> > ActiveStyle.prototype = {
> > initialize : function(element, activeTabId) {
> > this.activeTabId = activeTabId;
> > this.panelLinks = $('tabset').select('a');
> > Event.observe($(element), 'click', this.doConfirm
> > .bindAsEventListener(this));
> > },
> > doConfirm : function(e) {
> > this.panelLinks.each(function (element)
> > {
> > if (element.up().id == 'tab4') {
> > element.addClassName('active');
> > }else {
> > element.removeClassName('active');
> > }
> > })
> > }
> > }
> >
>
>
>
> --
> Howard M. Lewis Ship
>
> Creator Apache Tapestry and Apache HiveMind
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

Re: T5: Prototype question

Posted by Howard Lewis Ship <hl...@gmail.com>.
Do you mean:

this.activeTabId = 'tab4'

?

If not, there's your answer.

On Fri, Mar 27, 2009 at 11:35 AM, Peter Kanze <pe...@gmail.com> wrote:
> Hello
> Why is this working:
> if (element.up().id == 'tab4')
>      element.addClassName('active');
>
> And this not:
> if (element.up().id == this.activeTabId) {
>    element.addClassName('active');
>
> And this.activeTabId = tab4
>
> See here the full javascript code:
>
> var ActiveStyle = Class.create();
> ActiveStyle.prototype = {
> initialize : function(element, activeTabId) {
> this.activeTabId = activeTabId;
> this.panelLinks = $('tabset').select('a');
> Event.observe($(element), 'click', this.doConfirm
> .bindAsEventListener(this));
> },
> doConfirm : function(e) {
> this.panelLinks.each(function (element)
> {
> if (element.up().id == 'tab4') {
> element.addClassName('active');
> }else {
> element.removeClassName('active');
> }
> })
> }
> }
>



-- 
Howard M. Lewis Ship

Creator Apache Tapestry and Apache HiveMind

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org