document.getElementById("diagnosisBtn").addEventListener("click", function () { const f = document.getElementById("diagnosisForm"); const q = n => f[n] ? f[n].value : null; const q1 = q("q1"); const q2 = q("q2"); const q3 = q("q3"); const q4 = q("q4"); const q5 = q("q5"); const q6 = q("q6"); const q7 = q("q7"); if (!q1 || !q2 || !q3 || !q4 || !q5 || !q6 || !q7) { alert("すべての質問にお答えください。"); return; } let target = ""; // 前傾 if (q1 === "A" && (q4 === "A" || q6 === "A")) { target = "/kotsuban-zengkei/"; } // 後傾 else if (q2 === "A" && q6 === "B") { target = "/kotsuban-koukei/"; } // 左右差 else if (q3 === "A" || q7 === "A") { target = "/kotsuban-sayusa/"; } // ねじれ else { target = "/kotsuban-nejire/"; } window.location.href = target; });