This commit is contained in:
floriano committed 2026-09-24 15:15:12 +02:00
1 parent e42104c4fb
commit e80734527f
611 files changed
+64959

No files matched your search

+48
View File
@@ -0,0 +1,48 @@
<!DOCTYPE html>
<html lang="pl">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Lekcja 2.2</title>
<style>
#div1 {
width: 100px;
height: 100px;
background-color: cornflowerblue;
}
</style>
</head>
<body>
<div id="div1">
</div>
<script>
document.getElementById("div1").onclick = function() {
const data = JSON.stringify({
a: 1,
b: 2,
})
const options = {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: data
}
fetch("/test", options)
.then(function(response) {
return response.json();
})
.then(function(dataFromServer) {
alert(JSON.stringify(dataFromServer, null, 5))
})
.catch(function(error) {
console.error(error)
})
}
</script>
</body>
</html>
+43
View File
@@ -0,0 +1,43 @@
<!DOCTYPE html>
<html lang="pl">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Lekcja 2.3</title>
</head>
<body>
<label for="imie">Imię: </label>
<input type="text" name="imie" id="imie"><br>
<label for="nazwisko">Nazwisko: </label>
<input type="text" name="nazwisko" id="nazwisko"><br>
<button id="b1">Logowanie</button>
<script>
document.getElementById("b1").onclick = function() {
const data = JSON.stringify({
"imie": document.getElementById("imie").value,
"nazwisko": document.getElementById("nazwisko").value
})
const options = {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: data
}
fetch("/login", options)
.then(function(response) {
return response.json()
})
.then(function(data) {
console.log(JSON.stringify(data))
})
.catch(function(error) {
console.error(error)
})
}
</script>
</body>
</html>
+19
View File
@@ -0,0 +1,19 @@
<!DOCTYPE html>
<html lang="pl">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Lekcja 3</title>
</head>
<body>
<form method="post">
<input type="text" name="a" id="a">
<select name="c" id="c">
<option>suma</option>
<option>różnica</option>
</select>
<input type="text" name="b" id="b">
<input type="submit" value="Wyślij">
</form>
</body>
</html>
+37
View File
@@ -0,0 +1,37 @@
<!DOCTYPE html>
<html lang="pl">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Lekcja 3.4</title>
</head>
<body>
<input type="range" name="r1" id="r1">
<input type="range" name="r2" id="r2">
<script>
document.getElementById("r1").onchange = function() {
const data = JSON.stringify({
"r1": document.getElementById("r1").value
})
const options = {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: data
}
fetch("/range", options)
.then(function(response) {
return response.json()
})
.then(function(data) {
document.getElementById("r2").value = data.r2
})
.catch(function(error) {
console.error(error)
})
}
</script>
</body>
</html>