The easiest thing would be to just add an AbstractBehavior, override
renderHeader and call
renderOnDomReadyJavascript("dp.SyntaxHighlighter.HighlightAll('code');");

If it's the exact same string, it can be added as many times as you want and
Wicket will automatically only render it once.  Try this:

public class HomePage extends WebPage {
    private static final long serialVersionUID = 1L;
    public HomePage(final PageParameters parameters) {
        add(new Label("message", "If you see this message wicket is properly
configured and running"));
        add(new MyJSBehavior());
        add(new MyJSBehavior());
    }
    private static class MyJSBehavior extends AbstractBehavior {
        private static final long serialVersionUID = 1L;
        @Override
        public void renderHead(IHeaderResponse response) {
            super.renderHead(response);
            response.renderOnDomReadyJavascript("alert('test');");
        }
    }
}


-- 
Jeremy Thomerson
http://www.wickettraining.com


On Tue, Nov 25, 2008 at 10:26 PM, Anton Veretennikov <
[EMAIL PROTECTED]> wrote:

> Hi,
>
> JavaScript source files itself are inserted using <wicket:head> in
> CodeHighlightPanel's html.
> It's great that they are included only once though multiple
> CodeHighlightPanel's instances have it.
> How to make alone call
>
>  <script language="javascript">
>    dp.SyntaxHighlighter.HighlightAll('code');
>  </script>
>
> at the end of <body>?
>
> And not to have it at all if no CodeHighlightPanel was in output?
>
> I tested that several calls of it produce unexpected result.
>
> Tony.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

Reply via email to