team oppgave oppdatering av landingsside

This commit is contained in:
Geir Okkenhaug Jerstad 2024-08-16 13:01:04 +02:00
parent b3bf1ee8da
commit e58cbba8fa
3 changed files with 67 additions and 1 deletions

View file

@ -16,7 +16,10 @@
Linker:
<ol>
<li><a href="https://geokkjer.github.io/startit/intro_html">Intro HTML CSS Javascript</a></li>
<li><a href="https://geokkjer.github.io/startit/JS_freecodecamp">JS video freecodecamp</a><br/>
<li><a href="">Team oppgave uke 1.5 :-)</a></li>
</ol>
<ol>><li><a href="https://geokkjer.github.io/startit/JS_freecodecamp">JS video freecodecamp</a><br/>
<a href="https://www.youtube.com/watch?v=Zi-Q0t4gMC8">Video link</a></li>
<li><a href="https://geokkjer.github.io/startit/MDN">MDN</a></li>
<li><a href="https://geokkjer.github.io/startit/the_good_parts">JavaScript: The good the_good_parts</a></li>

View file

@ -0,0 +1,38 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Funksjoner med parameter</title>
<style>
body{
padding: 0;
margin: 0;
}
</style>
</head>
<body>
<input type="text">color
<div id="minDiv">
Hallo innerHTML
</div>
<button onclick="changeColorAndText('Ny tekst','green', 200, 50 )">Ny tekst</button>
<button onclick="blankAll()">reset</button>
<button onclick="changeColorAndText('blue', 'blue', 100, 150)">Style</button>
<script>
function changeColorAndText(text, bcolor, height, width) {
document.getElementById('minDiv').innerHTML = /*HTML*/ `
<div style="background-color: ${bcolor}; width: ${width}%; height: ${height}px;">${text}</div>
`;
}
function blankAll() {
document.getElementById('minDiv').style.background = 'white';
document.getElementById('minDiv').innerHTML = '';
}
</script>
</body>
</html>

View file

@ -0,0 +1,25 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Scope & parameter</title>
</head>
<body>
<div id="output"></div><br>
<button onclick="setNum16(16)">Set Number to 16</button>
<button onclick="setNum47(47)">Set Number to 47</button>
<br><br>
<script>
var outputDiv = document.getElementById('output');
var numToShow = 0;
function setNum(selectedNum){
numToShow = selectedNum;
outputDiv.innerHTML = numToShow;
}
</script>
</body>
</html>