SaveText.Ru

Рецепт борща
  1. var div_answer = document.getElementsByClassName("answer");
  2. var qtext = document.getElementsByClassName("qtext");
  3. var number = -1;
  4. for (var number_of_object = 0; number_of_object < div_answer.length; number_of_object++ ) {
  5. var object = div_answer[number_of_object];
  6. number += 1;
  7. answers = object.querySelectorAll("input");
  8. var min = parseInt(answers[0].value);
  9. var index = 0;
  10. for (var i = 0; i < answers.length; i++) {
  11. if (parseInt(answers[i].value) < min) {
  12. min = parseInt(answers[i].value);
  13. index = i;
  14. }
  15. }
  16. answers[index].setAttribute('checked','checked');
  17. g = object.querySelectorAll("label");
  18. console.log(qtext[number].innerText,'rn');
  19. console.log(index + 1, ' ', g[index].innerText,'rn');
  20. }

Share with your friends:

Print