function confirmappt(target) {
var type = document.getElementById("ultrasoundid").value
var ultrasound = document.getElementById("hdultrasoundid").value
var appt = document.getElementById('apptdocfacid').value
appt = 'apptid' + appt + '_1'
var checkedValue = 'test'
for (var i = 0; i < 100; i++) {
if (document.getElementsByName(appt)[i].checked) {
checkedValue = 'ok'
break;
}
}
if (checkedValue == 'ok') {
alert('Please select ultrasound type!');
}
if (confirm('Are you sure you want to make this appointment?'))
return true;
return false;
}
如果checkedValue等于ok,则警告,如果条件有效,则为秒。但如果条件不起作用,则checkedValue不等于ok,则为second。请帮我解决这个问题。
答案 0 :(得分:1)
您需要添加else
阻止
我认为你需要
if (checkedValue == 'ok') {
alert('Please select ultrasound type!');
}else{
return confirm('Are you sure you want to make this appointment?');
}
答案 1 :(得分:0)
我从您的问题陈述中了解到,如果checkValue为“ok”,您需要提醒,如果checkValue不是“ok”则需要确认对话
使用
if (checkedValue == 'ok') {
alert('Please select ultrasound type!');
}else{
if (confirm('Are you sure you want to make this appointment?'))
return true;
}