Skip to content

Commit

Permalink
Create cb.html
Browse files Browse the repository at this point in the history
  • Loading branch information
JustDeveloper1 authored Nov 15, 2024
1 parent 3e2fc58 commit 3a53e17
Showing 1 changed file with 73 additions and 0 deletions.
73 changes: 73 additions & 0 deletions experiments/cb.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>CommandBlock.js</title>
<style>
body {
background-color: black;
color: white;
font-family: Arial, sans-serif;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
height: 100vh;
}
.command-block {
background-color: #555;
border: 2px solid #888;
padding: 20px;
border-radius: 10px;
box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}
input[type="text"] {
width: 300px;
padding: 10px;
border: none;
border-radius: 5px;
margin-bottom: 10px;
}
button {
padding: 10px 15px;
border: none;
border-radius: 5px;
background-color: #007BFF;
color: white;
cursor: pointer;
}
button:hover {
background-color: #0056b3;
}
.output {
margin-top: 20px;
padding: 10px;
background-color: #222;
border-radius: 5px;
width: 300px;
word-wrap: break-word;
}
</style>
</head>
<body>
<div class="command-block">
<h2>Command Block</h2>
<input type="text" id="commandInput" placeholder="Enter JavaScript code here">
<button onclick="runCommand()">Run Command</button>
<div class="output" id="outputLabel"></div>
</div>

<script>
function runCommand() {
const command = document.getElementById('commandInput').value;
try {
const result = eval(command);
document.getElementById('outputLabel').innerText = result;
} catch (error) {
document.getElementById('outputLabel').innerText = 'Error: ' + error.message;
}
}
</script>
</body>
</html>

0 comments on commit 3a53e17

Please sign in to comment.