daily push

This commit is contained in:
Geir Okkenhaug Jerstad 2024-08-20 14:44:22 +02:00
parent 7ee0c5f323
commit 84430fe3ff
6 changed files with 128 additions and 1 deletions

View file

@ -31,7 +31,7 @@
<div id="heading">Ekstra</div>
<ol>
<li><a href="https://geokkjer.github.io/startit/eloquentjavascript">Eloquent Javascript</a></li>
<li><a href="https://geokkjer.github.io/startit/eloquentjavascript/">Eloquent Javascript</a></li>
<a href="https://eloquentjavascript.net/">Book Link</a>
</ol>
</div>

30
kodekos/login.html Normal file
View file

@ -0,0 +1,30 @@
<!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>
Navn: <input id="user" type="text">
Passord: <input id="pass" type="password">
<button onclick="changeText()">Log in</button>
<div id="text">Tekst</div>
<script>
function changeText(){
var name = document.getElementById('user').value;
var pass = document.getElementById('pass').value;
document.getElementById('text').innerHTML = /*HTML*/`
Navn: ${name}
Passord: ${pass}
`;
};
</script>
</body>
</html>
<!--
Vi ønsker å ta imot informasjon om brukernavn og passord fra en innloggingsside
Vi ønsker å endre teksten som vises på skjermen etter man har trykt på log in knappen -->

0
kodekos/variabler.html Normal file
View file

0
kodekos/variabler.js Normal file
View file

View file

@ -0,0 +1,42 @@
<!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>
<div id="app">
</div>
<script>
document.getElementById('app').innerHTML = createDateSelector();
function createDateSelector(){
return /*HTML*/`
<div class="vertical">
</div>
`;
};
function createNumberSelector(label, day, moth, year){
return /*HTML*/`
<div class="horizontal">
<label>${label}</label>
<div class="horizontal border">
<div class="number">${number}</div>
${createUpDownButton()}
</div>
</div>
`;
}
function createUpDownButton(){
return /*HTML*/ `
<div class="vertical">
<button>UP</button>
<button>DOWN</button>
`;
};
</script>
</body>
</html>

View file

@ -0,0 +1,55 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
div.traffic-lights{
display: grid;
background-color: black;
}
div.lights{
border-radius: 50%;
width: 3rem;
height: 3rem;
}
</style>
</head>
<body>
<div id="app" class="traffic-lights">
</div>
<script>
showGreen();
function showGreen(){
show('showYellow', 'grey', 'grey','green')
};
function showYellow(){
show('showRed', 'grey', 'yellow', 'grey')
};
function showRedYellow(){
show('showGreen','red','yellow','grey')
};
function showRed(){
show('showRedYellow','red','grey','grey')
};
function show(onclickFunc ,lamp1, lamp2, lamp3) {
document.getElementById('app').innerHTML = /*HTML*/ `
<div id="trafficLights" onclick="${onclickFunc}()">
${createLampHtml(lamp1)}
${createLampHtml(lamp2)}
${createLampHtml(lamp3)}
</div>
`;
};
function createLampHtml(color){
return /*HTML*/ `
<div class="lights" style="background-color: ${color};"></div>
`;
};
</script>
</body>
</html>