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:
For some reason when EU forced Microsoft to allow users to change the default browser and search provider in Windows (also no ads for Office and the likes) - it was good. But when it comes to Apple - then it's bad.
BTW, Apple would have gone out of business if Microsoft wasn't pressed by US government several decades ago. 😉
I understand Microsoft's intention here, at least I think I do.
There have been so many printer driver related problems over the years due to OEM printer drivers not be compatible with the latest Windows update, that Microsoft wants to eliminate those by controlling the printer driver updates and keeping them compatible with the latest Windows update.
That is okay as far it goes, but what it can do is put limitations on printers that wouldn't be there with OEM drivers since the OEM printer drivers are not universal drivers.
It's a tradeoff and one can only hope it doesn't turn all Windows printers into $69 Brother printers.
Vivaldi is a very unique browser. It's the only chromium based browser that has its own powerful and fully customizable UI. It even supports CSS like firefox based browsers do. If someone wants a powerhouse chromium based browser, Vivaldi is actually his only option. All other chromium based browsers just tweak the vanilla chromium UI. It also comes from an ethical company that has proved its ethics all these years. Something very rare in the chromium world... (all other companies which develop chromium based browsers own an ad company, Chrome, Edge, Brave, Opera etc).
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