【问题标题】:How to make a terminal like textarea, that you can type in?如何制作像 textarea 这样的终端,您可以输入?
【发布时间】:2015-03-18 07:23:30
【问题描述】:

我想创建一个文本区域,您可以在其中输入内容,黑色背景和绿色文本,“>_”闪烁。

我将如何做这个?

【问题讨论】:

标签: html css textarea


【解决方案1】:

你可以在你的 CSS 中使用它:

textarea {
    background-color: #000;
    border: 1px solid #000;
    color: #00ff00;
    padding: 8px;
    font-family: courier new;
}

【讨论】:

  • 你想要投票,而你所做的只是向我展示了一些我已经知道的 css? XD
  • 这将只满足颜色要求
  • 我不好的是没有看到你想在文本区域内眨眼
【解决方案2】:
<!doctype html>
<html>
<head>
<style>

</style>
<meta charset="utf-8" />
<title>Demo -TextArea</title>
<link rel="stylesheet" type="text/css" href="jqueryui.css">

<script src="jquery.js"></script>
<script src="jqueryui.js"></script>
<script>
$(document).ready(function() {
$("#myTextArea").html(">_");

setInterval(function(){
removeAndAppendBlickWraper();
},2000);

});

function removeAndAppendBlickWraper(){
        removeAndAppendBlick(function(){

                var text = $("#myTextArea").val(),
                withCursortext =text+">_";
                $("#myTextArea").val(withCursortext);

        });
}
function removeAndAppendBlick(callback){
var text = $("#myTextArea").val();
 var witoutCursor = text.substr(0,text.lastIndexOf(">_"));
 $("#myTextArea").val(witoutCursor);
 setTimeout(function(){
 callback();
 },1500);

}

</script>
</head>
<body>
<textarea id="myTextArea" style="background-color: black;color: green;" row="5"></textarea>
</body>
</html>

DEMO(感谢阿米特凯特)

【讨论】:

  • 它不会加载:/ 我尝试将 jqueryui 和 jquery 添加到文件中,但它只是一个白色的空白页。如果您可以默认添加它们,将会有很大帮助。谢谢:)
  • 你有这些文件吗?如果有,请检查你的文件路径。根据示例,将这些文件添加到同一文件夹中
  • k,它正在工作,但您的代码有错误,请检查您的标题标签 xD。
猜你喜欢
  • 2018-12-30
  • 1970-01-01
  • 1970-01-01
  • 2023-01-25
  • 1970-01-01
  • 2016-10-20
  • 1970-01-01
  • 1970-01-01
  • 2011-11-30
相关资源
最近更新 更多