echo "var i = 0\n";
echo "var param = 2\n\n";
//Проверка на искренность
echo "function check_iskren(temp_param, i)\n";
echo "{\n";
echo "if((temp_param == 1) && ((i == 30) || (i == 36) || (i == 42) || (i == 48)))\n";
echo "{\n";
echo "temp_param = temp_param * 3\n";
echo "iskren = iskren + temp_param\n";
echo "}\n";
echo "if((temp_param == 1) && ((i == 6) || (i == 12)))\n";
echo "{\n";
echo "temp_param = temp_param * 2\n";
echo "iskren = iskren + temp_param\n";
echo "}\n";
echo "if((temp_param == 1) && ((i == 18) || (i == 25) || (i == 24)))\n";
echo "{\n";
echo "iskren = iskren + temp_param\n";
echo "}\n";
echo "if((temp_param == 0) && (i == 23))\n";
echo "{\n";
echo "iskren = iskren + temp_param\n";
echo "}\n";
echo "}\n\n";
//Проверка качеств аналогична проверке в CGI-модуле
echo "function update_submit_form()\n";
echo "{\n";
echo "submit_form.iskren_hidden.value = iskren\n";
echo "submit_form.extrav_hidden.value = extrav\n";
echo "submit_form.rigid_hidden.value = rigid\n";
echo "submit_form.emo_vozb_hidden.value = emo_vozb\n";
echo "submit_form.temp_reak_hidden.value = temp_reak\n";
echo "submit_form.aktiv_hidden.value = activ\n";
echo "}\n\n";
//Взятие результатов
echo "function get_param(object)\n";
echo "{\n";
echo "if(object.elements[0].checked)\n";
echo "{\n";
echo "param = 1\n";
echo "return param\n";
echo "}\n";
echo "if(object.elements[1].checked)\n";
echo "{\n";
echo "param = 0\n";
echo "return param\n";
echo "}\n";
echo "}\n\n";
echo "function checking(object)\n";
echo "{\n";
echo "i++\n";
echo "get_param(object)\n";
echo "check_iskren(param,i)\n";
echo "check_extrav(param,i)\n";
echo "check_rigid(param,i)\n";
echo "check_emo_vozb(param,i)\n";
echo "check_temp_reak(param,i)\n";
echo "check_activ(param,i)\n";
echo "update_submit_form()\n";
echo "param = 2\n";
echo "}\n\n";
echo "</script>\n</head>\n";
echo "<body>\n";
//Вопросы на тест
$voprosy[] = "Самооценка структуры темперамента";
...
$voprosy[] = "Бывает, что вы говорите о вещах, в которых не совсем разбираетесь?";
for($i = 1; $i < 49; $i++)
{
echo $i;
echo ")\t";
echo $voprosy[$i];
echo "<form name = answer_form_$i>\n";
echo "<input type = radio name = Answer value = 1 onclick = 'javascript:checking(answer_form_$i);'> да\n";
echo "<br><input type = radio name = Answer value = 0 onclick = 'javascript:checking(answer_form_$i);'> нет\n";
echo "</form>\n";
echo "<br>";
}
echo "<form name = submit_form action = http://localhost/cgi/test_result.php method = get>\n";
echo "<input type = hidden name = iskren_hidden>\n";
echo "<input type = hidden name = extrav_hidden>\n";
echo "<input type = hidden name = rigid_hidden>\n";
echo "<input type = hidden name = emo_vozb_hidden>\n";
echo "<input type = hidden name = temp_reak_hidden>\n";
echo "<input type = hidden name = aktiv_hidden>\n";
echo "<input type = submit value = 'Получить результаты теста' onclick = 'javascript:update_submit_form();'>\n";
echo "</form>\n\n";
echo "</body>\n</html>";
?>
Уважаемый посетитель!
Чтобы распечатать файл, скачайте его (в формате Word).
Ссылка на скачивание - внизу страницы.