asd
This commit is contained in:
parent
9b693c4cf1
commit
7f2ddb3a86
BIN
24_10_21/24_10_21 - Frontend.pptx
Normal file
BIN
24_10_21/24_10_21 - Frontend.pptx
Normal file
Binary file not shown.
5
24_10_21/asd.mjs
Normal file
5
24_10_21/asd.mjs
Normal file
|
@ -0,0 +1,5 @@
|
|||
import * as Modul from "./koszontes.mjs";
|
||||
|
||||
console.log(Modul.duplaz(2));
|
||||
|
||||
console.log(Modul.koszontosDuplazas("Digi", 5));
|
77
24_10_21/fetch_genyo.html
Normal file
77
24_10_21/fetch_genyo.html
Normal file
|
@ -0,0 +1,77 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Document</title>
|
||||
</head>
|
||||
<body>
|
||||
<form>
|
||||
Cím: <input type="text" id="title"> <br>
|
||||
Id: <input type="number" id="id"> <br>
|
||||
Befejezett: <input type="checkbox" id="completed" value="0"> <br>
|
||||
</form>
|
||||
<button id="bekuld">Beküld</button>
|
||||
<div id="todos"></div>
|
||||
<script>
|
||||
let url = "https://jsonplaceholder.typicode.com/todos";
|
||||
document.getElementById("bekuld").addEventListener("click", function (){
|
||||
let cim = document.getElementById("title").value;
|
||||
let identification = document.getElementById("id").value;
|
||||
let completed = document.getElementById("completed").checked;
|
||||
|
||||
/*
|
||||
|
||||
fetch(url, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify({
|
||||
id: identification,
|
||||
title: cim,
|
||||
completed: completed
|
||||
}),
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
let divelement = document.createElement("div");
|
||||
let cim = document.createElement("h2");
|
||||
cim.innerHTML = data.title;
|
||||
|
||||
let asd = document.createElement("p");
|
||||
asd.innerHTML = `Az elem azonosítója: ${data.id} <br>
|
||||
Az elem befejezésének állapota: ${data.completed ? "befejezve" : "nem befejezett"}`;
|
||||
|
||||
divelement.appendChild(cim);
|
||||
divelement.appendChild(asd);
|
||||
|
||||
document.getElementById("todos").appendChild(divelement);
|
||||
|
||||
});
|
||||
|
||||
*/
|
||||
|
||||
|
||||
asd();
|
||||
|
||||
});
|
||||
|
||||
async function asd() {
|
||||
try{
|
||||
let response = await fetch(url);
|
||||
let data = await response.json();
|
||||
|
||||
console.log(data);
|
||||
} catch (error){
|
||||
console.log(error)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
63
24_10_21/fetching_images.html
Normal file
63
24_10_21/fetching_images.html
Normal file
|
@ -0,0 +1,63 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Document</title>
|
||||
</head>
|
||||
<body>
|
||||
<button id="lekeres">
|
||||
Adat lekérése
|
||||
</button>
|
||||
<div id="img_0">
|
||||
|
||||
</div>
|
||||
<div id="img_1">
|
||||
|
||||
</div>
|
||||
<div id="img_2">
|
||||
|
||||
</div>
|
||||
<script>
|
||||
let url = "https://jsonplaceholder.typicode.com/photos";
|
||||
|
||||
|
||||
|
||||
document.getElementById("lekeres").addEventListener("click", function () {
|
||||
adatlekeres();
|
||||
});
|
||||
|
||||
async function adatlekeres() {
|
||||
try {
|
||||
let response = await fetch(url);
|
||||
let data = await response.json();
|
||||
|
||||
for (let index = 0; index < 3; index++) {
|
||||
let cim = document.createElement("h2");
|
||||
cim.innerHTML = data[index].title;
|
||||
|
||||
let element = document.createElement("img");
|
||||
element.src = data[index].thumbnailUrl;
|
||||
|
||||
let divelement = document.getElementById(`img_${index}`);
|
||||
divelement.appendChild(cim);
|
||||
divelement.appendChild(element);
|
||||
}
|
||||
} catch (error){
|
||||
console.log(error);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
<!--
|
||||
type modulet kell használni
|
||||
<script type="module" src="scripts.mjs">
|
||||
udvozlet();
|
||||
</script>
|
||||
-->
|
||||
<script type="module" src="script.mjs">
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
9
24_10_21/koszontes.mjs
Normal file
9
24_10_21/koszontes.mjs
Normal file
|
@ -0,0 +1,9 @@
|
|||
function duplaz(num) {
|
||||
return num * 2;
|
||||
}
|
||||
|
||||
function koszontosDuplazas(nev, szam){
|
||||
return `Szia ${nev}! A duplázott érték: ${2 * szam}`;
|
||||
}
|
||||
|
||||
export {koszontosDuplazas, duplaz};
|
8
24_10_21/script.mjs
Normal file
8
24_10_21/script.mjs
Normal file
|
@ -0,0 +1,8 @@
|
|||
import * as Modul from './scripts.mjs';
|
||||
import {udvozles, valtozo} from "./scripts.mjs";
|
||||
|
||||
console.log(Modul.valtozo);
|
||||
|
||||
|
||||
|
||||
udvozles();
|
6
24_10_21/scripts.mjs
Normal file
6
24_10_21/scripts.mjs
Normal file
|
@ -0,0 +1,6 @@
|
|||
function udvozlet(){
|
||||
console.log("Hello!");
|
||||
};
|
||||
let valtozo = 15;
|
||||
let tomb = [1,2,3];
|
||||
export {udvozlet as udvozles, valtozo, tomb};
|
Loading…
Reference in New Issue
Block a user