In XHTML, those characters must be escaped. I believe that your problem
is in the interaction between XHTML and your browser: your browser is
probably trying to interpret the JavaScript via some flavor of HTML
quirks mode.
I'd recommend reading http://markmail.org/message/npzf2qptc5fw2yxz and
other messages about XHTML from the archives.
http://en.wikipedia.org/wiki/Quirks_mode might be helpful, too.
thanks,
-- Mike
On 2009-01-30 08:06, 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
<
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