Ver Mensaje Individual
  #3 (permalink)  
Antiguo 05/04/2004, 04:15
Avatar de KarlanKas
KarlanKas
Moderador extraterrestre
 
Fecha de Ingreso: diciembre-2001
Ubicación: Madrid
Mensajes: 6.987
Antigüedad: 22 años, 5 meses
Puntos: 61
Prueba con esto:
Código PHP:
<html>
<
head>
    <
title>Untitled</title>
</
head>

<
body>
<
script>
meses=["enero","febrero","marzo","abril","mayo","junio","julio","agosto","septiembre","octubre","noviembre","diciembre"];
function 
sumarFecha(fecha,suma){
    
dia=null;
    
fechas=fecha.split("-");
    
dia=new Date(fechas[2],parseInt(fechas[1]-1),parseInt(fechas[0])+suma);
    
document.getElementById('resultado').value=dia.getDate()+" de "+meses[dia.getMonth()]+" de "+dia.getYear()
    }

</script>
<input id="fecha1" type="text" 
onKeyUp="if((this.value.length==2 || this.value.length==5)&&this.value.charAt(this.value.length-1)!='-'){this.value+='-'}" size="10" maxlength="10" >
<select name="suma1">
<option>1
<option>2
<option>7
<option>15
</select>
<input type="text" id="resultado" readonly size="30"><br>
<input type="button" value="calcular"
 onclick="sumarFecha(document.getElementById('fecha1').value , parseInt(document.getElementById('suma1').options[document.getElementById('suma1').selectedIndex].text))">
</body>
</html> 

Pon en la primera la fecha con este formato: dd-mm-aaaa
las rayitas ya te las pone él.

Dime si te sirve
__________________
Cómo escribir

No hay pregunta tonta, sino tonto que quiere seguir en la ignorancia.