Files
Site-Web/fun/terminal.html
T
2026-05-16 11:10:19 +02:00

39 lines
1.1 KiB
HTML
Executable File

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Retro Terminal</title>
<style>
body { margin:0; background:black; color:#0f0; font-family:monospace; padding:20px; }
input { background:black; color:#0f0; border:none; width:100%; font-family:monospace; font-size:16px; }
</style>
</head>
<body>
<h3>Fake Terminal</h3>
<div id="output"></div>
<input id="cmd" placeholder="Type command..." autofocus>
<script>
const output=document.getElementById('output');
const input=document.getElementById('cmd');
const responses = {
help: "Try: hello, date, joke",
hello: "Hello there, human!",
date: new Date().toString(),
joke: "Why do programmers prefer dark mode? Because light attracts bugs!"
};
input.addEventListener('keydown', e=>{
if(e.key==='Enter'){
const cmd=input.value.trim();
output.innerHTML += `> ${cmd}<br>`;
output.innerHTML += (responses[cmd]||"Command not found") + '<br>';
input.value='';
window.scrollTo(0,document.body.scrollHeight);
}
});
</script>
</body>
</html>