📋 问卷制作

在线问卷/测试制作,创建题目/选项,生成可分享的HTML

添加题目

${data.title}

`; if (data.description) html += `

${data.description}

`; data.questions.forEach((q, i) => { html += `
${i + 1}. ${q.title}
`; if (q.type === 'text') { html += ''; } else { q.options.forEach(opt => { const t = q.type === 'radio' ? 'radio' : 'checkbox'; html += ``; }); } html += '
'; }); html += '
'; downloadFile(data.title + '.html', html, 'text/html'); } function exportJSON() { const data = getQuizData(); downloadFile(data.title + '.json', JSON.stringify(data, null, 2), 'application/json'); } function downloadFile(name, content, type) { const blob = new Blob([content], { type }); const url = URL.createObjectURL(blob); const a = document.createElement('a'); a.href = url; a.download = name; a.click(); URL.revokeObjectURL(url); } function clearAll() { if (questions.length && !confirm('确定清空所有题目?')) return; questions = []; document.getElementById('quizTitle').value = '未命名问卷'; document.getElementById('quizDesc').value = ''; renderQuestions(); } addQuestion('radio');