thejimhale
thejimhale

Reputation: 1

javascript in jsf xhtml template

Trying to put the following in my JSF xhtml template

<script type="text/javascript">
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

</script>

I substituted the && with &amp&amp and &ux0026&ux0026 but they don't seem to work

The error I get is: Error Parsing /templates/template.xhtml: Error Traced[line: 8] Element type "a.length" must be followed by either attribute specifications, ">" or "/>".

Does anyone if any suggestions/ideas how to get around this?

Upvotes: 0

Views: 3448

Answers (1)

Adam
Adam

Reputation: 5070

The problem is with < in i<a.length, you should escape it too (&lt;), or use CDATA as you said.

Also see this related question: javascript in jsf/icefaces

Upvotes: 1

Related Questions