JavaScript-Code funktioniert nicht auf der JSF-XHTML-Seite

Hier läuft der Code weiterGeige
Sie werden sehen, dass es hier einwandfrei funktioniert, aber wenn ich diesen Code in Eclipse mithilfe von Glassfish Server 3.2.1 auf einer XHTML-Seite ausführe, wird dieser Fehler angezeigt

javax.servlet.ServletException: Error Parsing /MasterPage/MiDASMaster.xhtml: Error Traced[line: 135] Open quote is expected for attribute "{1}" associated with an  element type  "class".


Hier ist der Code der xhtml-Seite (genau wie bei Fiddle), den ich auch bei Jsbin ausprobiert habe

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html>
<head>
<style type="text/css">
.highlight {
    background:yellow;
}
.removeHighlight {
    background:green;
}

</style>
<script type="text/javascript" src="../Scripts/jquery-1.8.3.js"/>
</head>
<body>

<script type="text/javascript">

            function test(){
        alert(document.getElementById("divId"));
         var regex = new RegExp('this',"gi");
         document.getElementById("divId").innerHTML     
         =document.getElementById("divId").innerHTML.replace(regex, function(matched) 
        {
            return '<span class=\'highlight\'>' + matched + '</span>';
        });


    }



</script>

<div id="divId">

    This is the text This is the text This is the text This is the text 
    This is the text This is the text This is the the text
</div>

..

Antworten auf die Frage(1)

Ihre Antwort auf die Frage