1. Single-choice button judgment refers to understanding it as a button group, which is similar to multi-choice box judgment.
// Select one of the selected buttons
VaR C = 0;
For (VAR I = 0; I <frm. elements. length; I ++ ){
If (FRM. elements [I]. Name = "Q1 "){
If (FRM. elements [I]. Checked)
{
C = C + 1;
Break;
}
}
}
If (C = 0)
{
Alert ("Question 1 is not filled! ");
Return (false );
}
C = 0;
2. You cannot use readonly when determining whether the text box is filled. You cannot use this attribute.
Set the disabled text box to <input type = "text" name = "other1" value = "" disabled>
If (! FRM. other5.disabled & frm. other5.value = '')
{
Alert ('question 5: no input! ');
FRM. other5.focus ();
Return false;
}
3. Click the read-only or invalid button to change
Button <input type = "checkbox" name = "Q3 []" value = "E" onclick = "other3.disabled =! Other3.disabled; other3.value = ''">
Text Box <input type = "text" name = "other3" disabled>