那是代码:
function pagechange(frompage, topage) {
var page = document.getElementById('formpage_' + frompage);
if (!page) return false;
page.style.visibility = 'hidden';
page.style.display = 'none';
page = document.getElementById('formpage_' + topage);
if (!page) return false;
page.style.display = 'block';
page.style.visibility = 'visible';
return true;
}
var currentShown = "";
function unhide(rad) {
var id = "answer" + rad.id.replace("-", "");
var answer = document.getElementById(id);
if (answer) {
var current = document.getElementById(currentShown);
if (current) current.className = "hidden";
currentShown = id;
answer.className = "unhidden";
}
}
var score = 0;
function scoreIncrement() {
score++;
document.getElementById("score").innerHTML = score;
}
然后这是我的带有该代码的网站页面:
http://elearning.easy2dev.com/quiz_template_3.php
单击 John 时,它应该将分数增加 1,然后在下方显示答案框,没有任何反应,但在 JS Fiddle 中它可以工作。它曾经可以工作,但我似乎以某种方式破坏了它。