한 폼에서 나이를 검증하려고 시도했습니다.이 문제는 크롬 콘솔에서 발견되었습니다. 내가 코드의 다른 곳의 URL 재배치를 넣어 경우 (같은 조건의 상단에)가 잘 작동하기 때문에, 내 코드와 함께 할 수있는 뭔가가 궁금리소스 자바 스크립트 window.location을로드하지 못했습니다.
<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>
: 이 내 코드입니다. window.location.assign("http://www.google.com")
또한 하나의 else
의 모든 팝업을 경고하기 위해 사용 오류에 주어진 좋은 설명의 어떤 제안
시도해보십시오. window.location.href = "http://www.google.com"; ' – Barmar
가 이미 실행되었지만 작동하지 않습니다. – pattpiuf