Оценка - показывая счетHtml

Программисты Html
Ответить
Anonymous
 Оценка - показывая счет

Сообщение Anonymous »

У меня есть проблема с показателем окончательной оценки в конце, есть много способов, которыми я могу сделать это, но я не уверен, что будет лучшим. Оценка является идентификатором, поэтому, очевидно, появляется только один раз, и он находится за пределами шоу/скрыть. PrettyPrint-Override ">

Код: Выделить всё

document.getElementsByName("score").innerHTML = score; [b]< /code>
вместо < /p>
document.getElementById("score").innerHTML = score;
< /code>
Но не повезло.  Есть идеи о том, как сделать это?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) {
// Get the id number of selected option
var id = rad.id;
var n = parseInt(id.substring(id.lastIndexOf("-") + 1), 10);
n += 4;

// Hide all answers
$(".unhidden").removeClass("unhidden").addClass("hidden");

// Show only the correct answer
$("#untitled-region-" + n).addClass("unhidden");
}

var score = 0;

function scoreIncrement(elem) {
if(!$(elem).data('scored')){
score++;
document.getElementById("score").innerHTML = score;
$(elem).data('scored', true);
}
}< /code>
.hidden { display: none; }
.unhidden { display: block; }< /code>


Score: 




Question 1:[/b] Who is the youngest in Big Media?[b] 

[list]
[*]
John

[*]
Paula

[*]
Henal

[*]
Malc

[/list]







Your answer is correct, John is 20.






Your answer is incorrect, Paula is 31.






Your answer is incorrect, Henal is 21.






Your answer is incorrect, Malc is 33.











Question 2:[/b] Who is the tallest in Big Media?[b] 

[list]
[*]
John

[*]
Paula

[*]
Henal

[*]
Malc

[/list]







Your answer is correct, John is 6ft2.






Your answer is incorrect, Paula is 5ft6.






Your answer is incorrect, Henal is 4ft9.






Your answer is incorrect, Malc is 5ft11.












Question 3:[/b] Who is the shortest in Big Media?


[list]
[*]
John

[*]
Paula

[*]
Henal

[*]
Malc

[/list]







Your answer is incorrect, John is 6ft2.






Your answer is incorrect, Paula is 5ft6.






Your answer is correct, Henal is 4ft9.






Your answer is incorrect, Malc is 5ft11.










Your score is:



Подробнее здесь: https://stackoverflow.com/questions/100 ... -the-score
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «Html»