Duvida formatacão com javaScript em JSP

calera eu tenho esse codigo aki, funciona blz eh uma pagina html normal mas nao funciona em uma JSP , pq?? e como resolver?
desde de ja agradeço.

Untitled Hora:

olha tinha erro de javascript por isso no jsp não passar sintax de javascript faltando “)” veja o código alterado e reveja sua lógica porque não sei o que você esta fazendo mas agora vai funcionar

<html>
    <head>
        <title>Untitled</title>
        <script type="text/javascript">
            //Chama o Metodo assim:
            // onKeyPress="ConsisteTecla(event.keyCode,this);"            
            function consisteTecla(event,campo)
            {
                var key_code = event.keyCode  ? event.keyCode  :
                    event.charCode ? event.charCode :
                    event.which    ? event.which    : void 0;
                alert(key_code);
                if (key_code > 47 && key_code < 5)
                {
                    return true;
                    consisteHora(campo);
                }
                else
                {
                    return false;
                }
            }
            function consisteHora(Campo)
            {
                back = '';
                if(Campo.value.length == 2)
                {
                    hrs = (Campo.value.substring(0,2));
                    if (hrs >= 00 && hrs <= 23)
                    {
                        Campo.value += ":";
                        event.returnValue = true;
                        back = (Campo.value.substring(0,3));
                    }
                    else
                    {
                        Campo.value = "";
                        event.returnValue = false;
                    }
                }
                else if(Campo.value.length == 4)
                {
                    var min = (Campo.value.substring(3,4));
                    if (min >= 0 && min < 6)
                    {
                        event.returnValue = true;
                    }
                    else
                    {
                        var back = (Campo.value.substring(0,3));
                        Campo.value = "";
                        Campo.value = back;
                        event.returnValue = false;
                    }
                }

            }
        </script>
    </head>
    <body>
        <form name="Frm" action="#">
            Hora: <input type='text' onkeypress="return consisteTecla(event,this);" size="5" maxlength="5">
        </form>
    </body>
</html> 

como dica use uma IDE tipo o netbenas 6.8 e o navegador firefox 3.6.3 com o complemento firebug ativado para identificar erros de javascript. Lembre-se de testar nele e no IE pois tem particularidades.