Ver Mensaje Individual
  #6 (permalink)  
Antiguo 25/01/2007, 07:15
Avatar de zaida
zaida
 
Fecha de Ingreso: noviembre-2006
Ubicación: Madrid (España)
Mensajes: 266
Antigüedad: 18 años, 3 meses
Puntos: 0
Re: al hacer click sobre una imagen añadir un año diferente

Hola de nuevo, tu código me funcionó, pero investigué para hacerlo un poco más sencillo, espero que te sirva de algo como a mi me sirvió el tuyo

<html>
<head>
<title>Inicio</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript">

ano= 2007;
function fechas_exceptuadas()
{
dia="12";
mes="01";
if(ano==2007)
{
fecha= dia+"-"+mes+"-"+ano;
opciones=document.getElementById('select').options ;
opciones[opciones.length]=new Option(fecha);
ano++;
}
else
{
fecha= dia+"-"+mes+"-"+ano;
opciones=document.getElementById('select').options ;
opciones[opciones.length]=new Option(fecha); ano++;
}
}
</script>

</head>
<body>
<img src="imagen.gif" onclick="fechas_exceptuadas()";>
<select name="select"></select>
</body>
</html>

Todo esto puede simplificarse mas y quedaría si:

ano= 2007;
function fechas_exceptuadas()
{
ano++;
dia="12";
mes="01";
fecha= dia+"-"+mes+"-"+ano;
opciones=document.getElementById('select').options ;
opciones[opciones.length]=new Option(fecha);
}
</script>

</head>
<body>
<img src="imagen.gif" onclick="fechas_exceptuadas()";>
<select name="select"></select>
</body>
</html>

Espero que me digas lo que te parece el script
Un saludo y mil gracias por ayudarme, si puedo ayudarte en algo aqui estaré

GRACIAS!!!!!!!!!!!!