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

Reply via email to