Simple:

If you're adding JS code from your Page.html file - put it in a
<wicket:head><!-- your script tag here --></wicket:head> tag.

If you're adding it from your Page.java file - do this:

        add(new AbstractBehavior() {
            @Override
            public void renderHead(IHeaderResponse response)
            {
                response.renderJavascript(javascript, id);
            }
        });

See the javadocs for what that ID does.

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



On Fri, Mar 27, 2009 at 6:03 PM, fachhoch <[email protected]> wrote:

>
>
> and my header section  already has some java script code
>
>
>                <script type="text/javascript">
>                        function jqCheckAll(){
>                                $("INPUT[type='checkbox']").attr('checked',
> $('#checkAllAuto').is(':checked'));
>                        }
>                </script>
>
>
>
> <script type="text/javascript">
>  window.onload = setupFunc();
> </script>
>
>
>
>
> from my page I am adding JS file using response.render(), the problem is
> wickets adds the script and css at the end of the my code in header section
> so all my java script functions defined will not work , is there a way to
> add the js and css at the top of my code in header section ?
>
> for eaxmple  this my html
>
> <head>
> <script>
>  my java script code
> </script>
> </head>
>
> when page is rendered
>
> <head>
> <script>
>  my java script code
> </script>
> <link rel="stylesheet" type="text/css"
> href="../../***********.css.CSSPATH/pagemask.js" />
>
> </head>
>
> i want this
>
> <head>
> <link rel="stylesheet" type="text/css"
> href="../../***********.css.CSSPATH/pagemask.js" />
> <script>
>  my java script code
> </script>
>
>
> </head>
>
>
> how to get this ?
>
> --
> View this message in context:
> http://www.nabble.com/adding-css-and-js-to-header-tp22751518p22751518.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>

Reply via email to