html css quiz,quiz.html

LeftValues Quiz

LeftValues


Loading...

Strongly Agree

Agree

Neutral/Unsure

Disagree

Strongly Disagree

Back

Back

var sc_project=12079783;

var sc_invisible=1;

var sc_security="fa5443fa";

var sc_https=1;

if(navigator.doNotTrack != 1) {

var statcounterscript=document.createElement('script');

statcounterscript.setAttribute("type","text/javascript");

statcounterscript.setAttribute("src", "https://www.statcounter.com/counter/counter.js");

document.getElementsByTagName("body")[0].appendChild(statcounterscript);

}

var max_a, max_b, max_c, max_d, max_e, max_f, max_g// Max possible scores

max_a = max_b = max_c = max_d = max_e = max_f = max_g = 0

var a, b, c, d, e, f, g // User's scores

a = b = c = d = e = f = g = 0

var qn = 0 // Question number

var prev_answer = null

init_question();

for (var i = 0; i < questions.length; i++) {

max_a += Math.abs(questions[i].effect.a)

max_b += Math.abs(questions[i].effect.b)

max_c += Math.abs(questions[i].effect.c)

max_d += Math.abs(questions[i].effect.d)

max_e += Math.abs(questions[i].effect.e)

max_f += Math.abs(questions[i].effect.f)

max_g += Math.abs(questions[i].effect.g)

}

function init_question() {

document.getElementById("question-text").innerHTML = (userLang in questions[qn].i18n) ? questions[qn].i18n[userLang] : questions[qn].question

document.getElementById("question-number").innerHTML = i18n.getString("quiz-question-of", [qn, questions])

if (prev_answer == null) {

document.getElementById("back_button").style.display = 'none'

document.getElementById("back_button_off").style.display = 'block'

} else {

document.getElementById("back_button").style.display = 'block'

document.getElementById("back_button_off").style.display = 'none'

}

}

function next_question(mult) {

a += mult*questions[qn].effect.a

b += mult*questions[qn].effect.b

c += mult*questions[qn].effect.c

d += mult*questions[qn].effect.d

e += mult*questions[qn].effect.e

f += mult*questions[qn].effect.f

g += mult*questions[qn].effect.g

qn++

prev_answer = mult

if (qn < questions.length) {

init_question()

} else {

results()

}

}

function prev_question() {

if (prev_answer == null) {

return

}

qn--

a -= prev_answer * questions[qn].effect.a

b -= prev_answer * questions[qn].effect.b

c -= prev_answer * questions[qn].effect.c

d -= prev_answer * questions[qn].effect.d

e -= prev_answer * questions[qn].effect.e

f -= prev_answer * questions[qn].effect.f

g -= prev_answer * questions[qn].effect.g

prev_answer = null

init_question()

}

function calc_score(score,max) {

return (100*(max+score)/(2*max)).toFixed(1)

}

function results() {

location.href = `results.html`

+ `?a=${calc_score(a,max_a)}`

+ `&b=${calc_score(b,max_b)}`

+ `&c=${calc_score(c,max_c)}`

+ `&d=${calc_score(d,max_d)}`

+ `&e=${calc_score(e,max_e)}`

+ `&f=${calc_score(f,max_f)}`

+ `&g=${calc_score(g,max_g)}`

}

一键复制

编辑

Web IDE

原始数据

按行查看

历史

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值