How to implement HTML-like command line interface
This time I will show you how to implement an HTML-like command line interface. What are the precautions for implementing an HTML-like command line interface? The following is a practical case, let's take a look.
HTML part
<!DOCTYPE html> <head> <meta charset="utf-8" /> <title>WeChat Manager</title> <link href="css/index.css" rel="stylesheet" type="text/css"> <script src="http://code.jquery.com/jquery-1.10.2.min.js"> </script> <script> $(document).ready(function(){ $(document).keyup(function(event){ if(event.keyCode ==13){ $.ajax({ type: "POST", url: "ok.php", data: "code="+$("#in").val(), success: function(msg){ $("ul").append("<li>"+$("#in").val()+"</li>"); //将输入的输出到界面 $("ul").append("<li>"+msg+"</li>"); //获取返回值并输出 $("#in").val(""); //清空输入框 $("#text").scrollTop($("#text").scrollTop()+32);//滚动条拉到最下面,显示出输入框 } }); } }); $("#in")[0].focus(); }); </script> </head> <body> <div class="window"> <div class="title"> <img src="css/1.jpg"> <span>Wechat Dos</span> </div> <div id="text"> <ul> <li>Welcome...</li> <li>login:</li> </ul> <input type="text" name="" id='in'> </div> </div> </body> </html>
CSS part
@charset "utf-8"; body { background-color:#396DA5; margin:0px; padding:0px; color:#fff; font:"微软雅黑"; font-size:14px;} .window { border:6px #ccc outset; width:680px; height:442px; background-color:#000; position:absolute; top:40px; left:68px; overflow:hidden} .title { background-color:#08246B; padding:2px;} #text { background-color:#000; border-top:#ccc outset 2px; height:420px; overflow-y:scroll;} ul { margin:0px; padding:0px; list-style:none;} input { background-color:#000; border:0; color:#fff; outline:none; /*font-size:12px;*/ width:100%}
I believe you have mastered the method after reading these cases. For more exciting content, please pay attention to other php Chinese websites related articles!
Related reading:
How to make the textarea text area width and height width and height automatically adapt
html hyperlink a After the click event, jump to the address pointed to by href
The above is the detailed content of How to implement HTML-like command line interface. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



Guide to Table Border in HTML. Here we discuss multiple ways for defining table-border with examples of the Table Border in HTML.

Guide to HTML margin-left. Here we discuss a brief overview on HTML margin-left and its Examples along with its Code Implementation.

This is a guide to Nested Table in HTML. Here we discuss how to create a table within the table along with the respective examples.

Guide to HTML Table Layout. Here we discuss the Values of HTML Table Layout along with the examples and outputs n detail.

Guide to HTML Input Placeholder. Here we discuss the Examples of HTML Input Placeholder along with the codes and outputs.

Guide to the HTML Ordered List. Here we also discuss introduction of HTML Ordered list and types along with their example respectively

Guide to Moving Text in HTML. Here we discuss an introduction, how marquee tag work with syntax and examples to implement.

Guide to HTML onclick Button. Here we discuss their introduction, working, examples and onclick Event in various events respectively.
