TimberVis Flexiboard: Visualization and Exploration Flexiboard for Timber Buildings IoT data sensors.
The pulse of the wood
Monitoring of Wooden houses: Time series of sensors data measuring
humidity, temperatures, vibrations and weather conditions.
https://lnu.se/forskning/forskningsprojekt/projekt-flexiboard-for-visualisering-och-utforskning-av-trabyggnader/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
59 lines
1.9 KiB
59 lines
1.9 KiB
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<title>Calculator</title>
|
|
</head>
|
|
<body>
|
|
<h1>Simple Calculator</h1>
|
|
<form id="calculatorForm">
|
|
<label for="num1">Number 1:</label>
|
|
<input type="number" id="num1" name="num1" required><br>
|
|
|
|
<label for="num2">Number 2:</label>
|
|
<input type="number" id="num2" name="num2" required><br>
|
|
|
|
<button type="submit">Calculate</button>
|
|
</form>
|
|
|
|
<h2>Result:</h2>
|
|
<div id="result"></div>
|
|
|
|
<script>
|
|
function handleSubmit(formId, fieldIds) {
|
|
const form = document.getElementById(formId);
|
|
form.addEventListener("submit", function (e) {
|
|
e.preventDefault();
|
|
const data = {};
|
|
fieldIds.forEach(fieldId => {
|
|
data[fieldId] = parseFloat(form.querySelector(`#${fieldId}`).value);
|
|
});
|
|
calculate(formId, data);
|
|
});
|
|
}
|
|
|
|
function calculate(formId, data) {
|
|
fetch("/calculate", {
|
|
method: "POST",
|
|
headers: {
|
|
"Content-Type": "application/json"
|
|
},
|
|
body: JSON.stringify(data)
|
|
})
|
|
.then(response => response.json())
|
|
.then(data => {
|
|
document.getElementById("result").textContent = `Result for form ${formId}: ${data.result}`;
|
|
})
|
|
.catch(error => {
|
|
console.error("Error:", error);
|
|
});
|
|
}
|
|
|
|
// Call handleSubmit when the DOM is fully loaded
|
|
document.addEventListener("DOMContentLoaded", function () {
|
|
handleSubmit("calculatorForm", ["num1", "num2"]);
|
|
// Add more forms and initialize them as needed with their respective field IDs
|
|
// handleSubmit("anotherForm", ["field1", "field2"]);
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|
|
|