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:
"TeamViewer is the fast, simple and friendly solution for remote access over the Internet"
Regarding the "friendly" description, has is stopped unceremoniusly booting your session after a couple of minutes accusing you of using it in a commercial environment?!
I hate religious supremacist genocidal maniacs. How antisemitic of you to imply that's what all Jews are like. Still no links I see. I guess when you're a zionists, backing your claims with proof doesn't matter. bEliEvE mE oR yOuRe hItLeR.
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