Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4623720
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T03:01:45+00:00 2026-05-22T03:01:45+00:00

I have this in my html file: <html> <head> <title> CMD.exe </title> <link rel=stylesheet

  • 0

I have this in my html file:

<html>
    <head>
        <title>
            CMD.exe
        </title>

        <link rel="stylesheet" type="text/css" href="cmd.css" />
        <script language="JavaScript" SRC="cmd.js"></script>
    </head>
    <body onload="blinkCursor();">
        <span id="content">&gt;</span><span style="display:none;" id="blink"  >|</span> 
        <div onKeyPress="keyPress(event);" style="position:absolute;z-index:2;width:100%;height:100%;"></div>   
    </body>
</html>

This is my Javascript:

var blinkOn =false;

function blinkCursor() {
    if (blinkOn) 
        {   
            document.getElementById("blink").style.display="none";
        } else {
            document.getElementById("blink").style.display="inline";
        }
    blinkOn=!blinkOn;
    setTimeout("blinkCursor()",500);    
}

function keyPress(e) {
    var keynum = ('which' in event) ? event.which : event.keyCode;
    var val=String.fromCharCode(keynum);
    document.getElementById("content").innerHTML=document.getElementById("content").innerHTML+val
}

And if combined with this CSS style here:

html, body {
        background-color:black;
        overflow:hidden;
        font-family:"lucida console";
        color:white;
    }

Creates a cool CMD-like webpage. The only problem is that the text input doesn’t work in Google Chrome but it works fine in IE (and perhaps ff?). I also don’t know how to detect keys such as [ENTER] and [BACKSPACE].

Any help would be appreciated!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T03:01:45+00:00Added an answer on May 22, 2026 at 3:01 am

    I ran a jsFiddle and it seems Chrome wasn’t registering the functions properly after the first blink. Also you were using event in the keyPress function when you’d defined it in the function as e. This worked for me:

    var blinkOn =false;
    
    blinkCursor = function() {
        if (blinkOn) 
            {   
                document.getElementById("blink").style.display="none";
            } else {
                document.getElementById("blink").style.display="inline";
            }
        blinkOn=!blinkOn;
        setTimeout("blinkCursor()",500);    
    }
    
    keyPress = function (e) 
    {
        var keynum = ('which' in e) ? e.which : e.keyCode;
        var val=String.fromCharCode(keynum);
        document.getElementById("content").innerHTML=document.getElementById("content").innerHTML+val
    }
    

    If you’re just having the “console” on the page as well you might as well switch the keyPress(event) from the div to the body tag.

    To detect Enter and Backspace etc check for their keyCode like so:

    keyPress = function (e)
    {
        //keynum setting
        if (keynum == 13) { // it's a return key press }
        //other stuff
    }
    

    Replace 13 with the keycode of whatever you’re looking to match.

    The Fiddle is here: http://jsfiddle.net/XuNv2/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this test python file import os print 'Content-type: text/html' print print '<HTML><HEAD><TITLE>Python
I have this code <html> <head> <style type=text/css> .frame {width: 50em; border: 1px solid
I have this input text: <html><head><meta http-equiv=content-type content=text/html; charset=utf-8></head><body><table cellspacing=0 cellpadding=0 border=0 align=center width=603>
Suppose we have the following HTML file: <html xmlns=http://www.w3.org/1999/xhtml> <head> <title>Test iframe download</title> <script
I have a site, from which you can download an HTML file. This HTML
I have a html page like this <html xmlns=http://www.w3.org/1999/xhtml> <head> <script src=JScript2.js type=text/javascript></script> <script
I have this HTML structure and want to convert it to an accordion. <div
I have this html... <select id=View name=View> <option value=1>With issue covers</option> <option value=0>No issue
Premise: I've started to study javascript and the DOM and I have this HTML
I have used this in my HTML: <q> Hai How r u </q> Which

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.