<!DOCTYPE html>
<html lang="en">

<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
JavaScript CMD <title>JavaScript CMD</title>
<style>
body {
background-color: #000;
color: #0f0;
font-family: monospace;
padding: 20px;
}
#output {
min-height: 400px;
overflow-y: auto;
border: 1px solid #0f0;
padding: 10px;
margin-bottom: 10px;
}
#command {
width: 100%;
padding: 10px;
font-family: monospace;
font-size: 16px;
border: 1px solid #0f0;
background-color: #000;
color: #0f0;
}
button {
font-family: monospace;
padding: 10px 20px;
font-size: 16px;
background-color: #0f0;
color: #000;
border: none;
cursor: pointer;
}
button:hover {
background-color: #fff;
color: #000;
}
</style>


JavaScript CMD


<div id="output"></div>

<button onclick="runCommand()">Çalıştır</button>

<script>
const output = document.getElementById('output');

function runCommand() {
const commandInput = document.getElementById('command');
const command = commandInput.value.trim();

if (!command) {
logOutput('Lütfen bir komut girin!');
return;
}

// Komutları işle
switch (command.toLowerCase()) {
case 'help':
logOutput('Kullanılabilir komutlar: help, clear, date, echo [text]');
break;
case 'clear':
output.innerHTML = '';
break;
case 'date':
logOutput(`Tarih ve Saat: ${new Date().toLocaleString()}`);
break;
default:
if (command.startsWith('echo ')) {
logOutput(command.slice(5));
} else {
logOutput(`'${command}' geçersiz komut. "help" yazmayı dene!`);
}
break;
}

// Komut girişini temizle
commandInput.value = '';
}

function logOutput(text) {
const line = document.createElement('div');
line.textContent = `> ${text}`;
output.appendChild(line);
output.scrollTop = output.scrollHeight; // Otomatik kaydır
}
</script>