I'm working on a fake MS-DOS console. I've made most of the design so far but I need help with programming the prompts. Here's how I would like it to work:
I've managed to restore the <blink> tag ;-) so that will help with an authentic look but ideally, I want the the user to be able to type anything in and his enter. When they do, a new line appears saying "Bad command or filename." and below that, the C:\> appears again and the user is able to continue to type stuff in. I would like to add commands like: "ver" or "dir" which shows some text as in the example above.
Here's the code so far, please copy/paste and try it out:
Completely irrelevant as long as pricing is garbage.
With OneDrive I get storage for about $18 / TB for a year.
With Proton it's $96.
For the record, Google One is around $48, Dropbox $69, iCloud $60.
In other words, Proton is the worst value BY FAR.
Not to mention with OneDrive I get full desktop and web office suites for 6 people.
Question
TonyLock
Can someone help me with some JavaScript?
I'm working on a fake MS-DOS console. I've made most of the design so far but I need help with programming the prompts. Here's how I would like it to work:
I've managed to restore the <blink> tag ;-) so that will help with an authentic look but ideally, I want the the user to be able to type anything in and his enter. When they do, a new line appears saying "Bad command or filename." and below that, the C:\> appears again and the user is able to continue to type stuff in. I would like to add commands like: "ver" or "dir" which shows some text as in the example above.
Here's the code so far, please copy/paste and try it out:
<html> <head> <title>JS-DOS</title> <meta http-equiv="Page-Enter" content="BlendTrans(Duration=0.25)" /> <meta http-equiv="Page-Exit" content="BlendTrans(Duration=0.25)" /> <link rel="shortcut icon" href="/dos/favicon.ico" /> <meta name="robots" content="noindex" /> <style type="text/css" media="all"> BODY{ BackGround: Black; Color: LightGrey; Font-Family: Courier New, Courier; Font-Size: 12pt; Font-Weight: Bold; Padding: 10px; Overflow: Auto; } BLINK{ Color: LightGrey; Font-Size: 13pt; } </style> <script type="text/javascript"> function Blink() { for(i=0;i<document.all.tags('blink').length;i++){ s=document.all.tags('blink')[i]; s.style.visibility=(s.style.visibility=='visible')?'hidden':'visible'; } } setInterval('Blink()',500); </script> </head> <body bgcolor="Black" scroll="Auto"> C:\><span id="Prompt"><blink>_</blink></span> </body> </html>I've experimented with the following JS code but I've had litle success getting my dead around it:
function ProcessKey(){ var KeyID = event.keyCode; var Key = String.fromCharCode(KeyID); //document.getElementById("Prompt").innerText += Key; var _body = document.getElementsByTagName('body') [0]; var _div = document.createElement('span'); var _text = document.createTextNode(Key) _div.appendChild(_text); _body.appendChild(_div); } document.onkeyup = ProcessKey;I'd appreciate any help. Thank you so much.
Link to comment
https://www.neowin.net/forum/topic/798508-js-dos-javascript-fake-html-dos-window/Share on other sites
14 answers to this question
Recommended Posts