Scientific Question Sheet Generator

Scientific Question Sheet Generator

Scientific Question Sheet Generator

Formulate a clear, focused, and testable question for any science experiment.

Your generated scientific question is shown below, framed to clearly define the cause and effect relationship you intend to investigate.

Final Scientific Question

Topic: ${sqsg_escapeHTML(sqsg_data.topic)} | Date Generated: ${date}

Scientific Question:

${questionHTML}

Breakdown:

  • Independent Variable (Cause): ${sqsg_escapeHTML(sqsg_data.independent) || 'N/A'}
  • Dependent Variable (Effect): ${sqsg_escapeHTML(sqsg_data.dependent) || 'N/A'}
  • Observation Goal: ${sqsg_escapeHTML(sqsg_data.goal) || 'N/A'}
`; } /** * Generates and downloads a PDF of the hypothesis */ async function sqsg_downloadPDF() { if (!sqsg_data.independent || !sqsg_data.dependent) { alert("Please complete the Independent and Dependent Variable sections before downloading."); return; } if (typeof jspdf === 'undefined' || typeof html2canvas === 'undefined') { alert("Error: PDF libraries failed to load."); return; } sqsg_renderPdfClone(); const { jsPDF } = window.jspdf; try { const canvas = await html2canvas(sqsg_pdfRenderClone, { scale: 1.5, useCORS: true }); const imgData = canvas.toDataURL('image/png'); const imgProps = { width: canvas.width, height: canvas.height }; const pdf = new jsPDF({ orientation: 'p', unit: 'pt', format: 'a4' }); const pdfWidth = pdf.internal.pageSize.getWidth(); const pdfHeight = pdf.internal.pageSize.getHeight(); const margin = 40; const contentWidth = pdfWidth - (margin * 2); const contentHeight = (contentWidth * imgProps.height) / imgProps.width; let heightLeft = contentHeight; let position = 0; pdf.addImage(imgData, 'PNG', margin, position + margin, contentWidth, contentHeight); heightLeft -= (pdfHeight - margin * 2); while (heightLeft > 0) { position -= (pdfHeight - margin * 2); pdf.addPage(); pdf.addImage(imgData, 'PNG', margin, position + margin, contentWidth, contentHeight); heightLeft -= (pdfHeight - margin * 2); } pdf.save('Scientific_Question_Sheet.pdf'); } catch (error) { console.error("PDF generation failed:", error); alert("An error occurred while generating the PDF."); } } // --- EVENT LISTENERS --- // Tab link clicks sqsg_tabLinks.forEach((link, index) => { link.addEventListener('click', () => sqsg_switchTab(index)); }); // Next/Prev button clicks if (sqsg_prevButton) { sqsg_prevButton.addEventListener('click', () => { if (sqsg_currentTab > 0) sqsg_switchTab(sqsg_currentTab - 1); }); } if (sqsg_nextButton) { sqsg_nextButton.addEventListener('click', () => { if (sqsg_currentTab === sqsg_tabLinks.length - 1) { sqsg_updateDataFromConfig(); sqsg_switchTab(0); } else { if (sqsg_currentTab < sqsg_tabLinks.length - 1) sqsg_switchTab(sqsg_currentTab + 1); } }); } // PDF download if (sqsg_downloadPdfButton) { sqsg_downloadPdfButton.addEventListener('click', sqsg_downloadPDF); } // --- Initialization --- sqsg_renderConfig(); sqsg_renderDashboard(); // Set initial tab state sqsg_tabPanes.forEach((pane, index) => { pane.classList.toggle('hidden', index !== 0); pane.classList.toggle('sqsg-active', index === 0); }); sqsg_tabLinks.forEach((link, index) => { TAB_CLASSES.active.forEach(cls => link.classList.remove(cls)); TAB_CLASSES.inactive.forEach(cls => link.classList.remove(cls)); if (index === 0) { TAB_CLASSES.active.forEach(cls => link.classList.add(cls)); } else { TAB_CLASSES.inactive.forEach(cls => link.classList.add(cls)); } }); });
Scroll to Top