html - 你如何做到这样有人可以在你的网站上输入 'type' 而无需输入文本框?

标签 html css

所以我目前正在开发一个类似网站的终端,您可以在其中输入命令,然后就会发生一些事情。这就是我的 CSS 和 HTML 文件的样子...

p {
  color: white;
  font-family: fixedsys, LucidaTerminal, monospace
}
.blink_text {
  -webkit-animation-name: blinker;
  -webkit-animation-duration: 1s;
  -webkit-animation-timing-function: linear;
  -webkit-animation-iteration-count: infinite;
  -moz-animation-name: blinker;
  -moz-animation-duration: 1s;
  -moz-animation-timing-function: linear;
  -moz-animation-iteration-count: infinite;
  animation-name: blinker;
  animation-duration: 1s;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
  color: white;
}
@-moz-keyframes blinker {
  0% {
    opacity: 1.0;
  }
  50% {
    opacity: 0.0;
  }
  100% {
    opacity: 1.0;
  }
}
@-webkit-keyframes blinker {
  0% {
    opacity: 1.0;
  }
  50% {
    opacity: 0.0;
  }
  100% {
    opacity: 1.0;
  }
}
@keyframes blinker {
  0% {
    opacity: 1.0;
  }
  50% {
    opacity: 0.0;
  }
  100% {
    opacity: 1.0;
  }
}
<!DOCTYPE html>

<head>
  <link rel="stylesheet" type="text/css" href="interface.css">
</head>

<body style="background-color:black;">
  <p style="display:inline">~/Link/Hydrogen/Helium/Lithium></p>
  <span class="blink_text">_</span>
</body>
所以我想要的是用户可以输入一个命令,按回车键,然后会发生一些事情,比如“打印'python'”或者像一个显示所有命令的帮助命令。另外,我该怎么做才能在他们按下回车键时执行命令。

最佳答案

使用带有文本区域的表单,并使边框和背景透明。不要添加提交按钮。按回车键提交(使用 javascript 回退)。这对你有用吗?

关于html - 你如何做到这样有人可以在你的网站上输入 'type' 而无需输入文本框?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36956172/

相关文章:

javascript - Cycle2 寻呼机不显示

java - 如何从另一个android应用程序 Assets 文件中读取html文件?

java - 无法附加 <p :ajax> to non-ClientBehaviorHolder parent

javascript - 调整子 DIV 的大小等于父 DIV

javascript - 链接/切换类时如何防止 "jumping"?

javascript - Angular js :split date and time parameters in angular ng-repeat

java - JSoup URL 链接困难

javascript - 如何根据屏幕宽度在 Javascript 中添加/删除类?

html - 我的 anchor 不工作

html - 摆好我的 table