Foros del Web » Programación para mayores de 30 ;) » Java »

2 funciones en un mismo botón

Estas en el tema de 2 funciones en un mismo botón en el foro de Java en Foros del Web. Hola. Necesito una mano. No se me imprimen las imágenes; sólo el "alert" y no sé por qué. Muchas gracias. <html> <head> <script type="text/javascript"> <!-- ...
  #1 (permalink)  
Antiguo 08/12/2011, 05:20
 
Fecha de Ingreso: agosto-2011
Mensajes: 8
Antigüedad: 12 años, 8 meses
Puntos: 0
2 funciones en un mismo botón

Hola.
Necesito una mano. No se me imprimen las imágenes; sólo el "alert" y no sé por qué.
Muchas gracias.
<html>

<head>
<script type="text/javascript">
<!--
function SetImage(id, filename)
{
var elem=document.getElementById(id);
if(elem)
{
elem.src=filename;
}
}
//-->
</script>
<SCRIPT language=JavaScript>
onload=init;
function init()
{
document.form1.Button1.onclick=pruebaClic;
}
function pruebaClic()
{
alert("¡ El botón ha sido pulsado !");
}
</SCRIPT>
</head>
<body>
<FORM name=form1>
<input type="submit" id="Button1" onclick="SetImage('Shape1','images/alligator.gif');
SetImage('Shape2','images/España.jpg');
return false;" name="pepe" value="Submit" style="position:absolute;left:277px;top:260px;widt h:96px;height:25px;font-family:Arial;font-size:13px;z-index:0">
<div id="wb_Shape1" style="margin:0;padding:0;position:absolute;left:5 45px;top:290px;width:92px;height:55px;text-align:center;z-index:1;">
<img src="images/img0001.gif" id="Shape1" alt="" title="" style="border-width:0;width:92px;height:55px"></div>
<div id="wb_Shape2" style="margin:0;padding:0;position:absolute;left:5 37px;top:224px;width:86px;height:35px;text-align:center;z-index:2;">
<img src="images/img0002.gif" id="Shape2" alt="" title="" style="border-width:0;width:86px;height:35px"></div>
</FORM>
</body>
</html>
  #2 (permalink)  
Antiguo 08/12/2011, 07:04
Avatar de Ronruby  
Fecha de Ingreso: julio-2008
Ubicación: 18°30'N, 69°59'W
Mensajes: 4.879
Antigüedad: 15 años, 9 meses
Puntos: 416
Respuesta: 2 funciones en un mismo botón

Este es el foro de Java, no Javascript. Le pediré a un moderador que te mueva al foro correcto.

Etiquetas: funciones
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 16:44.