SoloCodigo

Programación Web y Scripting => JavaScript => Mensaje iniciado por: lulial en Miércoles 4 de Agosto de 2004, 13:03

Título: Javascript En Servlet
Publicado por: lulial en Miércoles 4 de Agosto de 2004, 13:03
HOLA

TENGO YO QUIERO METER EN UN SERVLET UN JAVASCRIPT DE UN MENÚ QUE CAMBIA DE COLOR AL PASAR EL RATÓN, ESTE JAVASCRIPT ME FUNCIONA EN .HTM PERO AL METERLO EN EL SERVLET NO TIRA.

JAVASCRIPT EN .HTM
<table width="100%" cellpadding="0" border="0">
<tr>
<td width="31%" onMouseOver="this.style.backgroundColor='#E49147';" onMouseOut="this.style.backgroundColor='#739CE7';" onMouseDown="this.style.backgroundColor='#E49147';"
onMouseUp="this.style.backgroundColor='#E49147';" bgcolor="#739CE7" valign="bottom" height="20" onclick="window.location.href='/'"><a href="/" class="navlink"><font face="tahoma" size="2">   <font color="#FFFFFF">Portada</font></font></a></td>
</tr>
</table>

JAVASCRIPT EN .JAVA (SERVLET)
htmlPage += "<table width='100%' cellpadding='0' border='0'>";
htmlPage += "<tr> ";
htmlPage += "<td width='31%' onMouseOver='this.style.backgroundColor='#E49147';' onMouseOut='this.style.backgroundColor='#739CE7';' onMouseDown='this.style.backgroundColor='#E49147';' ";
htmlPage += "onMouseUp='this.style.backgroundColor='#E49147';' bgcolor='#739CE7' valign='bottom' height='20' onclick='window.location.href='/''><a href='/' class='navlink'><font face='tahoma' size='2'>   <font color='#FFFFFF'>Portada</font></font></a></td>";
htmlPage += "</tr>";
htmlPage += "</table>";

SIENDO htmlPage un String que luego se imprime:
 response.setContentType("text/html");
 out = response.getWriter();
 out.println(htmlPage);

GRACIAS

Un saludo