JS Küsimustik

Küsimustik

Küsimustik






Põhiharidus Keskharidus Kutseharidus Kõrgharidus
function VastusV1() { let vastusV1=document.getElementById(“vastusV1”); let name = document.getElementById(“name”).value; vastusV1.innerHTML=’Tere, ‘ + name; vastusV1.style.color = ‘green’; } function VastusV2() { let vastusV2=document.getElementById(“vastusV2”); let email=document.getElementById(“email”).value; vastusV2.innerHTML=’Teie e-post on: ‘ + email; vastusV2.style.color = ‘red’; } function VastusV3() { let vastusV3=document.getElementById(“vastusV3”); let male=document.getElementById(“male”); let female=document.getElementById(“female”); let other=document.getElementById(“other”); var gender = null; if (male.checked) { var gender = ‘Mees’; } else if (female.checked) { var gender = ‘Naine’; } else if (other.checked) { var gender = ‘Muud’; } else { gender = “”; } vastusV3.innerHTML=’Teie sugu on: ‘ + gender; vastusV3.style.color = ‘orange’; } function VastusV4() { let vastusV4=document.getElementById(“vastusV4”); let sport=document.getElementById(“sport”); let music=document.getElementById(“music”); let art=document.getElementById(“art”); let tech=document.getElementById(“tech”); var intrests=””; if(sport.checked){ intrests += sport.value+’, ‘; } if(music.checked){ intrests += music.value+’, ‘; } if(art.checked){ intrests += art.value+’, ‘; } if(tech.checked){ intrests += tech.value+’, ‘; } if (intrests == “”){ intrests = ‘Miks sul pole mingi huvid?’; } vastusV4.innerHTML=’Teie huvid on: ‘ + intrests; vastusV4.style.color = ‘pink’; } function VastusV5() { let vastusV5=document.getElementById(“vastusV5”); let education=document.getElementById(“education”).value; var educationText = ”; if (education == ‘none’) { educationText = ”; } else if (education == ‘basic’) { educationText = ‘Põhiharidus’; } else if (education == ‘secondary’) { educationText = ‘Keskharidus’; } else if (education == ‘vocational’) { educationText = ‘Kutseharidus’; } else if (education == ‘higher’) { educationText = ‘Kõrgharidus’; } vastusV5.innerHTML=’Teie haridus on: ‘+ educationText; vastusV5.style.color = ‘blue’; } function VastusV6() { let vastusV6=document.getElementById(“vastusV6”); let dob=document.getElementById(“dob”).value; vastusV6.innerHTML=’Teie sünniaeg on: ‘ + dob; vastusV6.style.color = ‘CadetBlue’; } function VastusV7() { let vastusV7=document.getElementById(“vastusV7”); let phone=document.getElementById(“phone”).value; vastusV7.innerHTML=’Teie telefoninumber on: ‘ + phone; vastusV7.style.color = ‘DarkGoldenRod’; } function VastusV8() { let vastusV8=document.getElementById(“vastusV8”); let birthplace=document.getElementById(“birthplace”).value; vastusV8.innerHTML=’Teie sünnikoht on: ‘ + birthplace; vastusV8.style.color = ‘DarkOliveGreen’; } function VastusV9() { let vastusV9=document.getElementById(“vastusV9″); vastusV9.innerHTML=’Aitäh tagasiside eest!’; vastusV9.style.color = ‘ForestGreen’; } function Vastus10() { let vastusV10 = VastusV1() + VastusV2() + VastusV3() + VastusV4() + VastusV5() + VastusV6() + VastusV7() + VastusV8() + VastusV9(); return vastusV10; } * { box-sizing: border-box; margin: 0; padding: 0; } .container { width: 600px; background-color: #fff; padding: 20px; border-radius: 8px; position: absolute; } h1 { text-align: center; margin-bottom: 20px; color: #333; } table { width: 100%; border-collapse: collapse; border: 2px solid #333; } td { padding: 10px; vertical-align: top; border: 1px solid #333; } label { color: #333; } input[type=”text”], input[type=”email”], input[type=”number”], input[type=”date”], input[type=”range”], textarea, select { width: 100%; padding: 10px; margin-top: 5px; border: 1px solid #ccc; border-radius: 4px; font-size: 16px; } input[type=”radio”], input[type=”checkbox”] { margin-right: 10px; } button { width: 100%; padding: 10px; background-color: #8fd39f; border: none; border-radius: 4px; font-size: 16px; cursor: pointer; } button:hover { background-color: #218838; } .vastus-column { width: 200px; word-wrap: break-word; }