Skip to content

Commit

Permalink
fourth js project
Browse files Browse the repository at this point in the history
  • Loading branch information
AryanMittal11 committed Jul 31, 2024
1 parent 19fbf0e commit a714cd3
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 0 deletions.
17 changes: 17 additions & 0 deletions Keyboard Check/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="style.css" />
<title>Event KeyCodes</title>
</head>
<body>
<div class="project">
<div id="insert">
<div class="key">Press the key and watch magic</div>
</div>
</div>
<script src="script.js"></script>
</body>
</html>
20 changes: 20 additions & 0 deletions Keyboard Check/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
const insert = document.getElementById("insert")

window.addEventListener('keydown', (e)=>{
insert.innerHTML = `
<div class = "tables">
<table>
<tr>
<th>Key</th>
<th>KeyCode</th>
<th>Code</th>
</tr>
<tr>
<td>${e.key === " " ? "Space" : e.key}</td>
<td> ${e.keyCode}</td>
<td>${e.code}</td>
</tr>
</table>
</div>
`
})
20 changes: 20 additions & 0 deletions Keyboard Check/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
table,
th,
td {
border: 1px solid #e7e7e7;
}
.project {
background-color: #1c1c1c;
color: #ffffff;
display: flex;
align-items: center;
justify-content: center;
text-align: center;
height: 100vh;
}

.color {
color: aliceblue;
display: flex;
flex-direction: row;
}

0 comments on commit a714cd3

Please sign in to comment.