나는 웹 사이트를 만들려고 노력하고 있습니다. 질문을하는 페이지가 있으며 선택한 라디오 버튼에 따라 두 가지 답변 중 하나가 표시됩니다. "예"를 선택하면 실패했음을 알립니다. 5 개를 모두 "아니오"로 선택하면 통과했음을 알려줍니다. 나는 세 가지 질문 만했을 때이 작업을 수행했지만, 두 개를 더 추가하여 총 5 개를 시도하고 코드를 변경하여 작동을 멈추게했습니다. 내가 선택한 선택에 상관없이 대답을주지 못한다. JavaScript가 깨어지기 시작합니다
이
은 내가 그것을 조정하려고 할 때 깨는 계속 왜 난 정말 이해가 안 돼요,이function answer(total) {
var score = 0;
if (document.getElementById('exp_no').checked) {
score++;
}
if (document.getElementById('chg_no').checked) {
score++;
}
if (document.getElementById('mur_no').checked) {
score++;
}
if (document.getElementById('off_no').checked) {
score++;
}
if (document.getElementById('fin_no').checked) {
score++;
}
if (score != 5) {
document.getElementById('totalScore').innerHTML = "You may not yet be
fully eligible to get your record expunged.Though this test should not be
considered as a definite answer.Please call 574 - 931 - 2173 or visit our
contact page to schedule a meeting
for a proper assessment.
";
toggletab();
} else {
document.getElementById('totalScore').innerHTML = "You appear to be eligible
for expungment!Please contact 574 - 931 - 2173 or visit our contact page to
schedule a meeting and to talk to about your next steps!";
toggletab2();
}
}
function answer(total) {
var score = 0;
if (document.getElementById('exp_no').checked) {
score++;
}
if (document.getElementById('chg_no').checked) {
score++;
}
if (document.getElementById('mur_no').checked) {
score++;
}
if (document.getElementById('off_no').checked) {
score++;
}
if (document.getElementById('fin_no').checked) {
score++;
}
if (score != 5) {
document.getElementById('totalScore').innerHTML = "You may not yet be
fully eligible to get your record expunged.Though this test should not be
considered as a definite answer.Please call 574 - 931 - 2173 or visit our
contact page to schedule a meeting
for a proper assessment.
";
toggletab();
} else {
document.getElementById('totalScore').innerHTML = "You appear to be eligible
for expungment!Please contact 574 - 931 - 2173 or visit our contact page to
schedule a meeting and to talk to about your next steps!";
toggletab2();
}
}
감사합니다 내 자바 스크립트 인 HTML
<form id="myForm">
<fieldset>
<h3>
<legend>Eligibility Test</legend>
</h3>
</fieldset>
<p>Please Answer the following questions to determine if you are eligible for expungement.</p>
<fieldset>
<legend>Have you had your record expunged before?</legend>
<input id="exp_yes" type="radio" name="field1" value="0" />
<label>
Yes
</label>
<input id="exp_no" type="radio" name="field1" value="1" />
<label>
No
</label>
</fieldset>
<fieldset>
<legend>Do you have any charges pending against you?</legend>
<input id="chg_yes" type="radio" name="field2" value="0" />
<label>
Yes
</label>
<input id="chg_no" type="radio" name="field2" value="1" />
<label>
No
</label>
</fieldset>
<fieldset>
<legend>Have any of your convictions ever been for a murder/manslaughter or attempt of the same?</legend>
<input id="mur_yes" type="radio" name="field3" value="0" />
<label>
Yes
</label>
<input id="mur_no" type="radio" name="field3" value="1" />
<label>
No
</label>
</fieldset>
<fieldset>
<legend>Have any of your convictions been for a sex crime or required you to sign up for the sex offender registry?</legend>
<input id="off_yes" type="radio" name="field4" value="0" />
<label>
Yes
</label>
<input id="off_no" type="radio" name="field4" value="1" />
<label>
No
</label>
</fieldset>
<fieldset>
<legend>Do you still owe any fines, fees, or restitution on any of criminal convictions?
</legend>
<input id="fin_yes" type="radio" name="field5" value="0" />
<label>
Yes
</label>
<input id="fin_no" type="radio" name="field5" value="1" />
<label>
No
</label>
</fieldset>
<fieldset id="submitbutton">
<input type="button" id="submit" value="submit" onclick='answer()' />
</fieldset>
<div id="first">
<p id="totalScore"></p>
</div>
</form>
입니다.
"깨는"의미는 무엇입니까? 오류를 붙여 넣을 수 있습니까? – fejanto