17/04/2009, 11:33
|
| | Fecha de Ingreso: abril-2009
Mensajes: 29
Antigüedad: 15 años, 7 meses Puntos: 0 | |
Boton clicable Hola a todos,
El programa de abajo es una pagina HTML generada por JAVA, alguien sabe como se hace para que al clicar AQUI en el boton me ejecute la función Public Class Prueba y me saque el valor AQUI
Gracias
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class Prueba extends HttpServlet
{
public static double rand()
{
double x1,inf,sup,contador=1,val=0;
x1=1;
inf=1;
sup=6;
while(contador<=x1)
{
val = Math.random()*100.0;
val= Math.floor(val);
if (val>=inf && val<=sup)
{
contador++;
}
}
return val;
}
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
{
int val=23;
PrintWriter out = response.getWriter();
out.println(" <TABLE BORDER=1>");
out.println(" <TR>");
out.println("<TD><IMG SRC=\"T1.jpg\"></TD>");
out.println(" <TD><IMG SRC=\"T2.jpg\"></TD>");
out.println("<TD><IMG SRC=\"T3.jpg\"></TD>");
out.println(" <TD><IMG SRC=\"T4.jpg\"></TD>");
out.println("<TD><IMG SRC=\"T5.jpg\"></TD>");
out.println(" <TD><IMG SRC=\"T6.jpg\"></TD>");
out.println(" <TD><IMG SRC=\"T7.jpg\"></TD>");
out.println(" <TD><IMG SRC=\"T8.jpg\"></TD>");
out.println("<TD><IMG SRC=\"T9.jpg\"></TD>");
out.println("<TD><IMG SRC=\"T10.jpg\"></TD>");
out.println("<TD><IMG SRC=\"T11.jpg\"></TD>");
out.println("<TD ROWSPAN=11 BGCOLOR=\"PINK\"><PRE>");
out.println("<FONT COLOR=\"GREEN\" SIZE=+3>");
out.println("<B>Dinero acumulado en la mesa: <INPUT TYPE=\"text\" NAME=\"\" value=\"\" size=2 style=\"background:transparent;color:green\" DISABLED></B>");
out.println(" <FONT COLOR=\"red\" SIZE=+3>");
out.println(" <B><U>Jugador 1</U></B>");
out.println(" </FONT><FONT COLOR=\"Blue\" SIZE=+2>");
out.println(" <B>Alias: <INPUT TYPE=\"text\" NAME=\"\" value=\"\"size=10 style=\"background:transparent;color:green\" DISABLED></B>");
out.println(" <B>Dinero acumulado: <INPUT TYPE=\"text\" NAME=\"\" value=\"\" size=2 style=\"background:transparent;color:green\" DISABLED></B>");
out.println("<B><form><center><INPUT TYPE=\"submit\" VALUE=\"AVENIDAS COMPRADAS\" ></center></form></B> </B> ");
out.println(" <B>Número de casas: <INPUT TYPE=\"text\" NAME=\"\" value=\"\" size=2 style=\"background:transparent;color:green\" DISABLED></B> ");
out.println(" <B>Número de hoteles: <INPUT TYPE=\"text\" NAME=\"\" value=\"\" size=2 style=\"background:transparent;color:green\" DISABLED></B> ");
out.println("</FONT>");
out.println(" <FONT COLOR=\"red\" SIZE=+3> ");
out.println("<B><U>Jugador 2</U></B>");
out.println(" </FONT><FONT COLOR=\"Blue\" SIZE=+2>");
out.println(" <B>Alias:<INPUT TYPE=\"text\" NAME=\"\" value=\"\" size=10 style=\"background:transparent;color:green\" DISABLED></B>");
out.println(" <B>Dinero acumulado:<INPUT TYPE=\"text\" NAME=\"\" value=\"\" size=2 style=\"background:transparent;color:green\" DISABLED></B>");
out.println("<B><form><center><INPUT TYPE=\"submit\" VALUE=\"AVENIDAS COMPRADAS\" ></center></form></B> </B> ");
out.println(" <B>Número de casas: <INPUT TYPE=\"text\" NAME=\"\" value=\"\" size=2 style=\"background:transparent;color:green\" DISABLED></B>");
out.println("<B>Número de hoteles: <INPUT TYPE=\"text\" NAME=\"\" value=\"\" size=2 style=\"background:transparent;color:green\" DISABLED></B>");
out.println(" </FONT>");
out.println("</PRE>");
out.println(" </TD>");
out.println("</TR>");
out.println("<TR>");
out.println(" <TD><IMG SRC=\"T40.jpg\"></TD>");
out.println(" <TD COLSPAN=9 ROWSPAN=9><IMG SRC=\"Tcentral.jpg\" USEMAP=\"#FOTO\">");
out.println(" <TD><IMG SRC=\"T12.jpg\"></TD>");
out.println(" </TR>");
out.println(" <TR>");
out.println("<TD><IMG SRC=\"T39.jpg\"></TD>");
out.println("<TD><IMG SRC=\"T13.jpg\"></TD>");
out.println("</TR>");
out.println("<TR>");
out.println("<TD><IMG SRC=\"T38.jpg\"></TD>");
out.println("<TD><IMG SRC=\"T14.jpg\"></TD>");
out.println("</TR>");
out.println("<TR>");
out.println("<TD><IMG SRC=\"T37.jpg\"></TD>");
out.println("<TD><IMG SRC=\"T15.jpg\"></TD>");
out.println("</TR>");
out.println(" <TR>");
out.println(" <TD><IMG SRC=\"T36.jpg\"></TD>");
out.println(" <TD><IMG SRC=\"T16.jpg\"></TD>");
out.println(" </TR>");
out.println(" <TR>");
out.println(" <TD><IMG SRC=\"T35.jpg\"></TD>");
out.println("<TD><IMG SRC=\"T17.jpg\"></TD>");
out.println("</TR>");
out.println(" <TR>");
out.println(" <TD><IMG SRC=\"T34.jpg\"></TD>");
out.println("<TD><IMG SRC=\"T18.jpg\"></TD>");
out.println("</TR>");
out.println("<TR>");
out.println(" <TD><IMG SRC=\"T33.jpg\"></TD>");
out.println(" <TD><IMG SRC=\"T19.jpg\"></TD>");
out.println(" </TR>");
out.println(" <TR>");
out.println(" <TD><IMG SRC=\"T32.jpg\"></TD>");
out.println(" <TD><IMG SRC=\"T20.jpg\"></TD>");
out.println(" <TR>");
out.println(" </TR>");
out.println(" <TR><TD COLSPAN=13 BGCOLOR=\"PINK\">");
out.println(" <table border=0 width=\"100%\" align=center>"); out.println("<td><INPUT TYPE=\"submit\" VALUE=\" LANZAR DADOS \" onclick=\"rand();\"><td> "); out.println("" + val + "");
out.println(" <td><INPUT TYPE=\"submit\" VALUE=\"COMPRAR CASAS U HOTELES\"></td>");
out.println("<td><form><INPUT TYPE=\"submit\" VALUE=\"SIGUIENTE TURNO\" HREF=\"TablerobuenoSN.html\"></form></td> <td> <INPUT TYPE=\"submit\" VALUE=\"SALIR\"></td> ");
out.println("</table>");
}
} |