이것은 내가 가지고있는 사이트의 양식 하단 부분입니다. TOS 계약 체크 박스를 추가하기 전에 모든 것이 잘 작동했습니다. 이제는 상자가 선택되었는지 여부에 관계없이 사용자에게 상자를 선택해야한다는 경고가 표시됩니다. 어떤 도움이라도 대단히 감사하겠습니다.확인란이 선택되어 있는지 확인합니다.
<input type='checkbox' value='yes' name='tosagree' id='tosagree'> <p>I have read and agree to the privacy policy and terms of use found on this site.</p>
<input type='submit' id='submit' name='submit' value='submit'><br /><br />
</form>
</div>
<script type='text/javascript'>
function validateForm()
{
var asking=document.forms["form"]["asaskingprice"].value,
reasons=document.forms["form"]["asreasons"].value,
timelines=document.forms["form"]["astimelines"].value,
sources=document.forms["form"]["assources"].value,
tos=document.forms["form"]["tosagree"].value;
if (asking==null || asking=="")
{
alert("Asking price must be filled out");
return false;
}
if (reasons==null || reasons=="")
{
alert("reasons must be filled out");
return false;
}
if (timelines==null || timelines=="")
{
alert("timelines must be filled out");
return false;
}
if (sources==null || sources=="")
{
alert("sources must be filled out");
return false;
}
if (document.forms["form"]["tosagree"].Checked!=true)
{
alert("You must agree to the terms of service");
return false;
}
}
</script>
권세가 :( –
@JoeFrambach HTTP : //meta.stackexchange합니다. com/a/185105/133242 ...이 문제를 해결하는 방법을 정확히 파악하려고합니다. –