1 つのフォームから年齢を検証しようとすると、Chrome のコンソールでこの問題が見つかりました。これは私のコードです:
<script type="text/javascript">
function CalAge() {
var dd = $("#day").val();
var mm = $("#month").val();
var yy = $("#year").val();
var age = 18;
var mydate = new Date();
mydate.setFullYear(yy, mm-1, dd);
var currdate = new Date();
currdate.setFullYear(currdate.getFullYear() - age);
if(dd !=0 || mm !=0 || yy !=0){ //whether one or all values havent been choosen
if ((currdate - mydate) < 18){
window.location = "http://www.google.com";
}
else{
alert("more than 18");
}
}
else{
alert("please register");
}
}
</script>
コード内の別の場所 (条件の上など) に URL の再配置を配置すると、問題なく動作するため、コードと関係があるのではないかと思います。なにか提案を