se non ho capito male questo è il codice che ti serve(ho modificato il precedente):
<html>
<head>
<script type="text/javascript">
x=new Array();
function data()
{
data1=document.myform.dat.value;
data2=document.myform.altra_data.value;
x=data1.split("/");
x[0]=parseInt(x[0])+parseInt(data2);
if((x[0]>31) &&((x[1]=="01")||(x[1]=="03")|| (x[1]=="05")||(x[1]=="07")||(x[1]=="08")||(x[1]=="10")||(x[1]=="12")))
{
x[0]="01";
x[1]=parseInt(x[1])+1;
if (x[1]<=9)
{
x[1]="0"+x[1];
}
}
if((x[0]>30) &&(x[1]=="04"||x[1]=="06"|| x[1]=="05"||x[1]=="09"||x[1]=="11"))
{
x[0]="01";
x[1]=parseInt(x[1])+1;
if (x[1]<=9)
{
x[1]="0"+x[1];
}
}
if((x[0]>28) &&(x[1]=="02"))
{
x[0]="01";
x[1]="03";
}
data_set= new Date(Date.UTC(2009,06,25,0,0,0));
time1=Date.parse(data_set);
data2_result= new Date(Date.UTC(x[2],x[1],x[0],0,0,0));
time2= Date.parse(data2_result);
if(time2>time1)
{alert("La data del campo è superiore");}
else{alert("La data del campo è inferiore");}
}
</script>
</head>
<body>
<form name="myform">
Data:<input type="text" name="dat" size="10"/>
Numero:<input type="text" name="altra_data" size="10"/>
<input type="button" value="Invia"onclick="data()">
</form>
</body>
</html>

Rispondi quotando