-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhtml.html
More file actions
32 lines (30 loc) · 1.06 KB
/
html.html
File metadata and controls
32 lines (30 loc) · 1.06 KB
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
<button id="clickMeButton">ClickMe</button>
<script>
document.getElementById("clickMeButton").addEventListener("click", function() {
alert("Button clicked!");
});
</script>
<div id="message" style="border: 1px solid black; align-content: center;">check this</div>
<script>
document.getElementById("message").addEventListener("mouseover", function()
{
this.style.color = "red";
this.textContent = "Mouse over the message!";
this.style.alignContent = "center";
this.style.backgroundColor = "yellow";
});
document.getElementById("message").addEventListener("mouseout", function()
{
this.style.color = "black";
this.textContent = "check this";
this.style.alignContent = "center";
this.style.backgroundColor = "white";
});
</script>
<input type="text" id="inputField" placeholder="Type something...">
<script>
document.getElementById("inputField").addEventListener("keydown", function()
{
console.log("Key pressed in input field, " + this.value);
});
</script>