<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" type="text/javascript"></script>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<script type="text/javascript">
$(function(){
$('.questionForm input[type=submit]').on('click', function(e){
var answer=0;
for(i=0;i<$('.group').length;i++){
$('.group').eq(i).each(function(id, elem){
if($(elem).find('input:checked').length!=0){
if($(elem).find('input:checked').attr('value')==1){
answer++;
}
}
})
}
var general = (answer/$('.group').length)*100;
var text = '';
console.log(general);
switch (true){
case general >= 75:
text = 'Молодец, 5!';
alert(text + " Тест пройден на: "+general + "%");
break;
case general >= 60:
text = 'Молодец, 4!';
alert(text + " Тест пройден на: "+general + "%");
break;
case general >= 50:
text = 'Молодец, 3!';
alert(text + " Тест пройден на: "+general + "%");
break;
case general < 50:
text = 'Плохо, 2!';
alert(text + " Тест пройден на: "+general + "%");
break;
}
return false
})
})
</script>
<title> Сборка ПК - Контактная информация </title>
<link href="style.css" rel="stylesheet" type="text/css" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>
<body>
<div id="wrap">
<div id="masthead">
<h1>Все о сборке ПК</h1>
<div id="menucontainer">
<div id="menunav">
<ul>
<li><a href="F:\Web-Сайт\www.sborka-pk.ru\Главная.html"><span>Главная</span></a></li>
<li><a href="F:\Web-Сайт\www.sborka-pk.ru\Обучение.html"><span>Обучение</span></a></li>
<li><a href="F:\Web-Сайт\[url]www.sborka-pk.ru\Контактная[/url] информация.html" class="current"><span>Контактная информация </span></a></li>
</ul>
</div>
</div>
</div>
<br>
<font size="+2"><p align="center">
Тест по теме: Знакомство с ПК и его составными</font></p>
<div class = "questionBlock">
<font size="+1"><br>
<form method="POST" action="test.php" class="questionForm">
<div class="group">
Вопрос 1:<br>
<input type = "radio" name="q1" value="0">1<br>
<input type = "radio" name="q1" value="1">2<br>
<input type = "radio" name="q1" value="0">3<br>
<input type = "radio" name="q1" value="0">4<br>
<input type = "radio" name="q1" value="0">5<br>
<input type = "radio" name="q1" value="0">6<br>
</div>
<br>
<div class="group">
Вопрос 2:<br>
<input type = "radio" name="q2" value="1">1)<br>
<input type = "radio" name="q2" value="0">2)<br>
<input type = "radio" name="q2" value="0">3)<br>
<input type = "radio" name="q2" value="0">4)<br>
<input type = "radio" name="q2" value="0">5)<br>
</div>
<br>
<div class="group">
Вопрос 3:<br>
<input type = "radio" name="q3" value="0">1)<br>
<input type = "radio" name="q3" value="0">2)<br>
<input type = "radio" name="q3" value="1">3)<br>
</div>
<br>
<div class="group">
Вопрос 4:<br>
<input type = "radio" name="q4" value="0">1)<br>
<input type = "radio" name="q4" value="0">2)<br>
<input type = "radio" name="q4" value="0">3)<br>
<input type = "radio" name="q4" value="1">4)<br>
</div>
<br>
<div class="group">
Вопрос 5:<br>
<input type = "radio" name="q5" value="1">1)<br>
<input type = "radio" name="q5" value="0">2)<br>
<input type = "radio" name="q5" value="0">3)<br>
<input type = "radio" name="q5" value="0">4)<br>
</div>
<br>
<div class="group">
Вопрос 6:<br>
<input type = "radio" name="q6" value="1">1)<br>
<input type = "radio" name="q6" value="0">2)<br>
<input type = "radio" name="q6" value="0">3)<br>
<input type = "radio" name="q6" value="0">4)<br>
</div>
<br>
<div class="group">
Вопрос 7:<br>
<input type = "radio" name="q7" value="0">1)<br>
<input type = "radio" name="q7" value="0">2)<br>
<input type = "radio" name="q7" value="1">3)<br>
<input type = "radio" name="q7" value="0">4)<br>
</div>
<br>
<div class="group">
Вопрос 8:<br>
<input type = "radio" name="q8" value="0">1)<br>
<input type = "radio" name="q8" value="1">2)<br>
<input type = "radio" name="q8" value="0">3)<br>
<input type = "radio" name="q8" value="0">4)<br>
</div>
<br>
<div class="group">
Вопрос 9:<br>
<input type = "radio" name="q9" value="0">1)<br>
<input type = "radio" name="q9" value="1">2)<br>
<input type = "radio" name="q9" value="0">3)<br>
<input type = "radio" name="q9" value="0">4)<br>
</div>
<br>
<br>
<div class="group">
Вопрос 10:<br>
<input type = "radio" name="q10" value="0">1)<br>
<input type = "radio" name="q10" value="0">2)<br>
<input type = "radio" name="q10" value="0">3)<br>
<input type = "radio" name="q10" value="1">4)<br>
</div><br>
<input type="submit" value="ОТПРАВИТЬ" name="submit" />
</form>
</font>
</div>
<div id="navcontainer">
</div>
<p></p>
</div>
<div id="content">
<h2>
</h2>
</div>
</div>
</div>
<div id="footer">
</body>
</html>