Lekcja 3
This commit is contained in:
1 parent
6cc32f5146
commit
ba10d195ce
3 files changed
+90
No files matched your search
@@ -0,0 +1,90 @@
|
||||
<!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>
|
||||
<style>
|
||||
textarea {
|
||||
resize: none;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h2>2</h2>
|
||||
<input style="font-family: monospace;" type="text" name="whata" id="frika" size="42">
|
||||
<script>
|
||||
let string = " Ciekawe czy uda Ci się to zrobić "
|
||||
const pole = document.querySelector("#frika")
|
||||
pole.value = string
|
||||
|
||||
setInterval(function () {
|
||||
string = `${string}${string[0]}`;
|
||||
string = string.substring(1, string.length)
|
||||
pole.value = string
|
||||
}, 250);
|
||||
</script>
|
||||
|
||||
<hr>
|
||||
<h2>3</h2>
|
||||
<pre><textarea name="tablice" id="tablice" cols="40" rows="10"></textarea></pre>
|
||||
<script>
|
||||
const textarea = document.getElementById("tablice")
|
||||
const tablica = new Array()
|
||||
let wylosowano = 0
|
||||
|
||||
function getRandomInt(min, max) { // z w3
|
||||
return Math.floor(Math.random() * (max - min + 1)) + min;
|
||||
}
|
||||
|
||||
setInterval(function () {
|
||||
let wiersz = '';
|
||||
for (let i = 0; i < 40; i++) {
|
||||
let losuj = Math.random()
|
||||
if (losuj < 0.05) {
|
||||
losuj = Math.random()
|
||||
if (losuj < 0.5) {
|
||||
wiersz += String.fromCharCode(getRandomInt(65, 90));
|
||||
} else {
|
||||
wiersz += String.fromCharCode(getRandomInt(97, 122));
|
||||
}
|
||||
} else {
|
||||
wiersz += ' ';
|
||||
}
|
||||
}
|
||||
wylosowano++
|
||||
if (wylosowano > 10) {
|
||||
tablica.unshift('')
|
||||
if (wylosowano > 20) {
|
||||
wylosowano = 0
|
||||
}
|
||||
} else {
|
||||
tablica.unshift(wiersz)
|
||||
}
|
||||
if (tablica.length > 10) { tablica.pop() }
|
||||
|
||||
textarea.value = tablica.join('\n')
|
||||
}, 250)
|
||||
</script>
|
||||
|
||||
<hr>
|
||||
<h2>1</h2>
|
||||
<img src="img.png" alt="gitea" style="width: 200px;">
|
||||
<script>
|
||||
const img = document.getElementsByTagName("img")[0];
|
||||
let zwieksz = true;
|
||||
|
||||
setInterval(function () {
|
||||
let szer = parseInt(img.style.width)
|
||||
|
||||
zwieksz ? szer += 10 : szer -= 10
|
||||
if (szer >= 300 | szer <= 10) { zwieksz = !zwieksz }
|
||||
|
||||
img.style.width = szer + 'px';
|
||||
}, 100);
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
Reference in new issue
Block a user