It is nothing fancy, that way you simply write '//' into the contents of the 
script element, which is JavaScript line comment marker..

:-)

>


Drs. G.P.H. Josten
Consultant


http://www.daidalos.nl/
Daidalos BV
Source of Innovation
Hoekeindsehof 1-4
2665 JZ Bleiswijk
Tel.: +31 (0) 10 850 1200
Fax: +31 (0) 10 850 1199
http://www.daidalos.nl/
KvK 27164984
De informatie - verzonden in of met dit emailbericht - is afkomstig van 
Daidalos BV en is uitsluitend bestemd voor de geadresseerde. Indien u dit 
bericht onbedoeld hebt ontvangen, verzoeken wij u het te verwijderen. Aan dit 
bericht kunnen geen rechten worden ontleend.


> From: [email protected]
> [mailto:[email protected]] On Behalf Of
> Eric Palmitesta
> Sent: vrijdag 30 januari 2009 17:27
> To: General Mark Logic Developer Discussion
> Subject: Re: [MarkLogic Dev General] embedded javascript
> problem converting< to &lt; even though I'm using a CDATA section
>
> Interesting!  Can you explain how/why that works?
>
> Eric
>
> Robert Koberg wrote:
> >
> > On Jan 30, 2009, at 11:16 AM, Tim Meagher wrote:
> >
> >> I reckon using a separate .js file is the way to go - I especially
> >> appreciate the {' '} hint.
> >
> > You could do away with ML processing for this type of thing if you
> > just
> > used:
> >
> > <script>//</script>
> >
> > best,
> > -Rob
> >
> >
> >>
> >>
> >> Thanks,
> >>
> >> Tim
> >>
> >> -----Original Message-----
> >> From: [email protected]
> >> [mailto:[email protected]] On Behalf Of Eric
> >> Palmitesta
> >> Sent: Friday, January 30, 2009 11:12 AM
> >> To: General Mark Logic Developer Discussion
> >> Subject: Re: [MarkLogic Dev General] embedded javascript problem
> >> converting< to &lt; even though I'm using a CDATA section
> >>
> >> I ran into similar problems with in-script and in-line
> javascript in
> >> xquery pages, but all problems were mitigated by relocating all JS
> >> code to *.js files and referencing them via <script
> type="text/javascript"
> >> src="file.js">{' '}</script>, leaving only simple JS
> function calls
> >> in my xquery code.
> >>
> >> The {' '} is there between the script tags to prevent
> marklogic from
> >> collapsing them into <script ... />.
> >>
> >> Eric
> >>
> >> Tim Meagher wrote:
> >>> I have trying to embed some javascript in an xquery file and am
> >>> enclosing the script in a CDATA section, but when the
> page renders,
> >>> the less than operator
> >>>
> >>>     <
> >>>
> >>> is getting converted to
> >>>
> >>>     &lt;
> >>>
> >>> which renders the javascript useless.  Here's the javascript code
> >>> (note
> >> the
> >>> less than comparator used in for loop of the clearForm function)
> >>> embedded
> >> in
> >>> the head element:
> >>>
> >>> ---------------------------------------------------------
> >>>
> >>> <head><title>blah blah blah</title>
> >>>    <script type="text/javascript">
> >>>        <![CDATA[
> >>>        var foo = function() { alert('test') };
> >>>
> >>>        function clearForm(oForm) {
> >>>            var elements = oForm.elements;
> >>>            oForm.reset();
> >>>            for(i=0; i<elements.length; i++) {
> >>>                field_type = elements[i].type.toLowerCase();
> >>>                switch(field_type) {
> >>>                    case "text":
> >>>                    case "password":
> >>>                    case "textarea":
> >>>                    case "hidden":
> >>>                        elements[i].value = "";
> >>>                        break;
> >>>                    case "radio":
> >>>                    case "checkbox":
> >>>                        if (elements[i].checked) {
> >>>                            elements[i].checked = false;
> >>>                        }
> >>>                        break;
> >>>                    case "select-one":
> >>>                    case "select-multi":
> >>>                        elements[i].selectedIndex = -1;
> >>>                        break;
> >>>                    default:
> >>>                        break;
> >>>                }
> >>>            }
> >>>        }
> >>>        ]]>
> >>>    </script>
> >>> </head>
> >>>
> >>> ---------------------------------------------------------
> >>>
> >>> - Tim
> >>>
> >>>
> >>> _______________________________________________
> >>> General mailing list
> >>> [email protected]
> >>> http://xqzone.com/mailman/listinfo/general
> >> _______________________________________________
> >> General mailing list
> >> [email protected]
> >> http://xqzone.com/mailman/listinfo/general
> >>
> >>
> >> _______________________________________________
> >> General mailing list
> >> [email protected]
> >> http://xqzone.com/mailman/listinfo/general
> >
> > _______________________________________________
> > General mailing list
> > [email protected]
> > http://xqzone.com/mailman/listinfo/general
> _______________________________________________
> General mailing list
> [email protected]
> http://xqzone.com/mailman/listinfo/general
>

_______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general

Reply via email to