-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.html
64 lines (54 loc) · 1.87 KB
/
test.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<!DOCTYPE html>
<html lang="de" dir="ltr">
<head>
<meta charset="utf-8">
<title>Test code snippets</title>
</head>
<body>
<h2>Basics</h2>
<h3>Buttons und Links</h3>
<h4>Button sollte ein Link sein</h4>
<!-- falsch -->
<button onclick="location.href='http://baselone.ch'">
ich wäre besser ein Link
</button>
<h4>Link</h4>
<!-- richtig -->
<a href="http://baselone.ch">richtig so</a>
<h4>Link sollte ein Button sein</h4>
<form class="formToSubmit" action="index.html" method="post">
<a href="" onclick="event.preventDefault();document.querySelector('.formToSubmit').submit();">ich wäre besser ein Button</a>
</form>
<!-- welche Events triggert der Button? -->
<button id="eventSource">events</button>
<script>
document.querySelector('#eventSource').addEventListener('click', () => console.log('click event triggered'));
</script>
<form>
<input id="events">
</form>
<script>
const eventInput = document.querySelector('#events');
eventInput.addEventListener('keydown', (e) => console.log('keydown', e));
eventInput.addEventListener('keypress', (e) => console.log('keypress (deprecated)', e));
eventInput.addEventListener('keyup', (e) => console.log('keyup', e));
eventInput.addEventListener('input', (e) => console.log('input', e));
eventInput.addEventListener('change', (e) => console.log('change', e));
</script>
<h2>Weird divs</h2>
<form onsubmit="alert('form submitted')">
<input type="text" />
<button type="submit">Send</button>
</form>
<h2>Eigenimplementationen</h2>
<select>
<option>Basel</option>
<option disabled>Zürich</option>
<option>Bern</option>
<optgroup label="Ausland">
<option>München</option>
<option>Brüssel</option>
</optgroup>
</select>
</body>
</html>