OK. What if I want all the JS to be inline (no .js file to be made)?
I saw that wicket created a .js file...


igor.vaynberg wrote:
> 
> response.renderOnLoadJavascript() takes just the javascript - like the
> javadoc says. no need for you to output the script tags.
> 
> -igor
> 
> On Tue, Oct 28, 2008 at 11:33 AM, eyalbenamram <[EMAIL PROTECTED]>
> wrote:
>>
>>        public void renderHead(IHeaderResponse response) {
>>
>>
>>                StringBuffer config = new StringBuffer();
>>
>>                config.append("<script language=\"JavaScript\">\n");
>>                config.append("function removeBlur(checked) {\n");
>>                config.append("if(checked) {\n");
>>               
>> config.append("document.getElementById('login_button').disabled =
>> false;\n");
>>                config.append("} else {\n");
>>               
>> config.append("document.getElementById('login_button').disabled =
>> true;\n");
>>                config.append("} }\n");
>>                config.append("</script>\n");
>>
>>                response.renderOnLoadJavascript(config.toString());
>>
>>
>>
>> igor.vaynberg wrote:
>>>
>>> what is your code look like?
>>>
>>> -igor
>>>
>>> On Tue, Oct 28, 2008 at 11:28 AM, eyalbenamram <[EMAIL PROTECTED]>
>>> wrote:
>>>>
>>>> Hi again,
>>>>
>>>> I used IHeaderContributer, and the javascript code is now garbled and
>>>> not
>>>> working.
>>>> Here is what I got:
>>>>
>>>> <script type="text/javascript"
>>>> src="resources/org.apache.wicket.markup.html.WicketEventReference/wicket-event.js"></script>
>>>> <script type="text/javascript" ><!--/*--><![CDATA[/*><!--*/
>>>> Wicket.Event.add(window, "load", function() { <script
>>>> language="JavaScript">
>>>> function removeBlur(checked) {
>>>> if(checked) {
>>>> document.getElementById('login_button').disabled = false;
>>>> } else {
>>>> document.getElementById('login_button').disabled = true;
>>>> } }
>>>> </script>
>>>> ;});
>>>> /*-->]]>*/</script>
>>>>
>>>>
>>>>
>>>> igor.vaynberg wrote:
>>>>>
>>>>> use iheadercontributor, that should work much better
>>>>>
>>>>> also make sure your page has <body> tag.
>>>>>
>>>>> -igor
>>>>>
>>>>> On Tue, Oct 28, 2008 at 10:57 AM, eyalbenamram
>>>>> <[EMAIL PROTECTED]>
>>>>> wrote:
>>>>>>
>>>>>> Hi
>>>>>> I am inserting javascript code like this:
>>>>>>
>>>>>>                StringBuffer config = new StringBuffer();
>>>>>>
>>>>>>                config.append("<script language=\"JavaScript\">\n");
>>>>>>                config.append("function onLoad() { getValue();
>>>>>> setTimeout(\"onRefresh();\","+ns.getAutoRefreshSecs()*1000+"); }\n");
>>>>>>                config.append("function onRefresh(){\n");
>>>>>>
>>>>>> config.append("document.getElementById('hiddenVar').value
>>>>>> =
>>>>>> document.getElementById('textString').value;\n");
>>>>>>                config.append("window.location.reload(); }\n");
>>>>>>                config.append("function getValue() {\n");
>>>>>>
>>>>>> config.append("document.getElementById('textString').value
>>>>>> =
>>>>>> document.getElementById('hiddenVar').value; }\n");
>>>>>>                config.append("</script>\n");
>>>>>>
>>>>>>                /*open to activate JS*/
>>>>>>                add(new StringHeaderContributor(config.toString()));
>>>>>>
>>>>>>
>>>>>> and receive an error in log file:
>>>>>>
>>>>>> http-6789-2 ERROR html.WebPage -
>>>>>> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>>>>>> http-6789-2 ERROR html.WebPage - You probably forgot to add a <body>
>>>>>> or
>>>>>> <header> tag to your markup since no Header Container was
>>>>>> found but components where found which want to write to the <head>
>>>>>> section.
>>>>>> <script language="JavaScript">
>>>>>> function removeBlur(checked) {
>>>>>> if(checked) {
>>>>>> document.getElementById('login_button').disabled = false;
>>>>>> } else {
>>>>>> document.getElementById('login_button').disabled = true;
>>>>>> } }
>>>>>> </script>
>>>>>>
>>>>>> although my html file contains a <head> tag, and the javascript code
>>>>>> actually appears in the rendered page (when I look at the source of
>>>>>> the
>>>>>> page).
>>>>>>
>>>>>> any idea?
>>>>>>
>>>>>> Thanks,Eyal.
>>>>>> --
>>>>>> View this message in context:
>>>>>> http://www.nabble.com/inserting-javascript-from-java-to-html-file-tp20212650p20212650.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]
>>>>>>
>>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>>>
>>>>>
>>>>>
>>>>
>>>> --
>>>> View this message in context:
>>>> http://www.nabble.com/inserting-javascript-from-java-to-html-file-tp20212650p20213238.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]
>>>>
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>
>>>
>>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/inserting-javascript-from-java-to-html-file-tp20212650p20213326.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]
>>
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/inserting-javascript-from-java-to-html-file-tp20212650p20213513.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