-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpopup.js
22 lines (17 loc) · 946 Bytes
/
popup.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
document.addEventListener('DOMContentLoaded', function() {
var evaluateBtn = document.getElementById('evaluateBtn');
var resultDiv = document.getElementById('result');
evaluateBtn.addEventListener('click', function() {
var designScore = parseInt(document.getElementById('design').value);
var usabilityScore = parseInt(document.getElementById('usability').value);
var pricingScore = parseInt(document.getElementById('pricing').value);
if (isNaN(designScore) || isNaN(usabilityScore) || isNaN(pricingScore)) {
resultDiv.innerHTML = 'Please enter valid scores for all parameters.';
return;
}
var totalScore = designScore + usabilityScore + pricingScore;
var averageScore = totalScore / 3;
resultDiv.innerHTML = 'Total Score: ' + totalScore + '<br>' +
'Average Score: ' + averageScore.toFixed(2);
});
});