Perceived Stress Scale Calculator
About this app
Calculate your perceived stress level using the Perceived Stress Scale
Perceived Stress Scale Calculator Perceived Stress Scale Calculator Question 1: Question 2: Question 3: Question 4: Question 5: Question 6: Question 7: Question 8: Question 9: Question 10: Calculate
Related apps
Put this on your site
Source
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>Perceived Stress Scale Calculator</title>
<meta name="description" content="Calculate your perceived stress level using the Perceived Stress Scale">
<meta name="keywords" content="perceived stress scale, stress, calculator, tool">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<link href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">
<!-- Built-In Functions for Apps -->
<script type="text/javascript">
var localStoragePrefix = "ct-168796785769556";
var lastSave = 0;
// save to localstorage
function saveLocal(data) {
if (Date.now() - lastSave < 1000) {
return;
}
// save to cookie
let cookie = localStoragePrefix + "=" + JSON.stringify(data) + "; path=" + window.location.pathname + "'; SameSite=Strict";
cookie += "; expires=" + new Date(Date.now() + 1000 * 60 * 60 * 24 * 365 * 1000).toUTCString();
document.cookie = cookie;
lastSave = Date.now();
}
// load from localstorage
function loadLocal() {
var cookiePrefix = localStoragePrefix + "=";
var cookieStart = document.cookie.indexOf(cookiePrefix);
if (cookieStart > -1) {
let cookieEnd = document.cookie.indexOf(";", cookieStart);
if (cookieEnd == -1) {
cookieEnd = document.cookie.length;
}
var cookieData = document.cookie.substring(cookieStart + cookiePrefix.length, cookieEnd);
return JSON.parse(cookieData);
}
}
// Perceived Stress Scale Calculator
function calculatePerceivedStress() {
var answers = [];
var totalScore = 0;
// Get answers from input fields
for (var i = 1; i <= 10; i++) {
var answer = parseInt($("#question-" + i).val());
if (!isNaN(answer)) {
answers.push(answer);
totalScore += answer;
}
}
// Display score and interpretation
$("#score").text("Total Score: " + totalScore);
if (totalScore >= 0 && totalScore <= 13) {
$("#interpretation").text("Interpretation: Low perceived stress");
} else if (totalScore >= 14 && totalScore <= 26) {
$("#interpretation").text("Interpretation: Moderate perceived stress");
} else if (totalScore >= 27 && totalScore <= 40) {
$("#interpretation").text("Interpretation: High perceived stress");
} else {
$("#interpretation").text("Invalid score");
}
// Save answers to local storage
saveLocal(answers);
}
// Initialize calculator with saved answers
$(document).ready(function() {
var savedAnswers = loadLocal();
if (savedAnswers) {
for (var i = 1; i <= savedAnswers.length; i++) {
$("#question-" + i).val(savedAnswers[i-1]);
}
calculatePerceivedStress();
}
});
</script>
<style>
.container {
max-width: 600px;
margin: 0 auto;
padding: 20px;
}
h1 {
text-align: center;
margin-bottom: 20px;
}
label {
font-weight: bold;
}
input {
width: 100%;
margin-bottom: 10px;
}
#score {
font-weight: bold;
margin-top: 20px;
}
#interpretation {
margin-top: 10px;
}
</style>
</head>
<body>
<div id="main-container" class="container">
<h1>Perceived Stress Scale Calculator</h1>
<form>
<div class="mb-3">
<label for="question-1">Question 1:</label>
<input type="number" id="question-1" min="0" max="4">
</div>
<div class="mb-3">
<label for="question-2">Question 2:</label>
<input type="number" id="question-2" min="0" max="4">
</div>
<div class="mb-3">
<label for="question-3">Question 3:</label>
<input type="number" id="question-3" min="0" max="4">
</div>
<div class="mb-3">
<label for="question-4">Question 4:</label>
<input type="number" id="question-4" min="0" max="4">
</div>
<div class="mb-3">
<label for="question-5">Question 5:</label>
<input type="number" id="question-5" min="0" max="4">
</div>
<div class="mb-3">
<label for="question-6">Question 6:</label>
<input type="number" id="question-6" min="0" max="4">
</div>
<div class="mb-3">
<label for="question-7">Question 7:</label>
<input type="number" id="question-7" min="0" max="4">
</div>
<div class="mb-3">
<label for="question-8">Question 8:</label>
<input type="number" id="question-8" min="0" max="4">
</div>
<div class="mb-3">
<label for="question-9">Question 9:</label>
<input type="number" id="question-9" min="0" max="4">
</div>
<div class="mb-3">
<label for="question-10">Question 10:</label>
<input type="number" id="question-10" min="0" max="4">
</div>
</form>
<button class="btn btn-primary" onclick="calculatePerceivedStress()">Calculate</button>
<div id="score"></div>
<div id="interpretation"></div>
</div>
</body>
</html>
NEW APPS
These are apps made by the community!