-1
Good evening. I am a beginner in programming and a student of T.I. I just created my account here at Stackoveflow. I have basics (WELL basics) of Python and Javascript (and HTML and CSS as well).
I am trying to develop a simple program for a project of my course, where we have a "company" of T.I. that needs a method of control of service flow, to define the priority of service orders.
The idea is that the program asks some questions regarding the service. Each question receives a value if the answer is positive or negative. At the end of the program, the values are summed, and if they reach a given score, they are categorized as Priority 1, Priority 2 or Priority 3.
I made a template using Javascript and HTML, however, it is not working at all.
Take it easy, I know you probably have some pretty crazy mistakes. If anyone can help, I’d appreciate it
var per1 = document.getElementByName('p1');
var per2 = document.getElementByName('p2');
var per3 = document.getElementByName('p3');
var rs = document.getElementById('res');
function calc() {
if (per1 == 's') {
var per1 = 1;
} else if (per1 == n) {
var per1 = 2;
} else {
alert('Por favor, digite um valor válido!');
}
if (per2 == s) {
var per2 = 1;
} else if (per2 == n) {
var per2 = 2;
} else {
alert('Por favor, digite um valor válido!');
}
if (per3 == s) {
var per3 = 3;
} else if (per3 == n) {
var per3 = 1;
} else {
alert('Por favor, digite um valor válido!');
}
var rs = (per1 + per2 + per2);
innerHTML.res += ` ${rs}`;
}
<!doctype html>
<html lang="pt-BR">
<head>
<meta charset=utf-8>
<title>Priority IT</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<header>
<h1>Priority IT - <em>dualreceiver</em></h1>
</header>
<section>
<div id="d1">
<img src="dualreceiver.png" alt="Logo dualreceiver">
<h2>Perguntas:</h2>
<h3><em>Responda com "s" para SIM ou "n" NÃO:</em></h3>
</div>
</section>
<div id="d2">
<p><strong>1</strong>. O diagnóstico foi conciso? <input type="text" name="p1"></p>
<p><strong>2</strong>. Você considera que o problema será resolvido de forma relativamente rápida? <input type="text" name="p2"></p>
<p><strong>3</strong>. Cliente é PCD, idoso ou necessita atenção especial? <input type="text" name="p3"></p>
<input type="button" value="Calculate" onclick='calc()'>
<p><div id="res"> Calculando... </div></p>
<script src="script.js"></script>
</div>
</body>
</html>
Thank you very much!
– dualreceiver
I know it was some kind of silly mistakes, I’ll study more. Thank you very much!
– dualreceiver