ok. thank, I'll try it (though I have never written JavaScript till a few
days ago...)
BTW, why is the difference between the overriding method and the behavior
method?

On Thu, May 15, 2008 at 2:52 PM, Johan Compagner <[EMAIL PROTECTED]>
wrote:

> use a behavior that adds an onDocumentLoad/Ready script to the browser
>
> On Thu, May 15, 2008 at 12:35 PM, Eyal Golan <[EMAIL PROTECTED]> wrote:
>
> > Hello,
> > I have a MyButton that extends Button.
> > I have a JavaScript that I need to ad to the output markup after the
> > button's markup.
> > I'm trying to do this with two differnet options:
> > Either I Override onAfterRender in MyButton:
> >    @Override
> >    protected void onAfterRender() {
> >        if (isVisible()) {
> >            getResponse().write(Consts.getResizeScript(getMarkupId()));
> >        }
> >        super.onAfterRender();
> >    }
> >
> > Or, I add to the button a behavior and write this:
> >    @Override
> >    public void onRendered(Component component) {
> >        if (component.isVisible()) {
> >
> >
> >
> component.getResponse().write(Consts.getResizeScript(component.getMarkupId()));
> >        }
> >
> >    }
> >
> > Now, the situation is like this:
> > Using the first option (override in the component), the script is added
> to
> > the end of the html. Just after the </html>
> > Using the second option (the behavior), the script is added just after
> the
> > close tag of the button </button>.
> >
> > Using FF, all is ok, but in IE7, there's a problem in calculating the
> size
> > and the button is not shown correctly.
> >
> > What causes the differences? and how can I manipulate the behavior to
> work
> > like option 1 ?
> >
> > Thanks very much...
> >
> > --
> > Eyal Golan
> > [EMAIL PROTECTED]
> >
> > Visit: http://jvdrums.sourceforge.net/
> >
>



-- 
Eyal Golan
[EMAIL PROTECTED]

Visit: http://jvdrums.sourceforge.net/

Reply via email to