您好,欢迎访问一九零五行业门户网

我们如何在HTML中显示文本区域?

the task we are going to perform in this article is how do we display a text area in html. let’s dive into the article for getting a clear idea on how we display text area.
html textarea标签定义了一个多行纯文本编辑控件。由于文本空间可以容纳无限数量的字符(通常是courier),所以文本以固定宽度字体显示。在表单中,textarea通常用于收集用户输入,例如评论或评价。在提交表单后,表单数据中的引用将需要name属性。
let’s look into the following examples to know more about how do we display a textarea in html.
example 1在下面的示例中,我们使用了多行输入控件。
<!doctype html><html><body> <form action=https://www.tutorialspoint.com/index.htm> <label for=name>name:</label><br> <input type=text id=name name=name><br> <p><label for=comment>about yourself:</label></p> <textarea id=comment name=comment rows=5 cols=35> i'm from hyderabad,telengana </textarea><br> <input type=submit value=submit> </form></body></html>
在运行上述脚本时,输出窗口弹出,显示了用于输入姓名的输入字段和用于自我介绍的文本区域,以及一个提交按钮。如果您点击提交按钮,表单将被提交。
example 2:使用javascriptconsidering the following example we are running script to change the context in the text area.
<!doctype html><html><body> address:<br> <textarea id=tutorial> kavuri incore 9 hyderabad </textarea> <button type=button onclick=myfunction()>click to change</button> <script> function myfunction() { document.getelementbyid(tutorial).value = madhapur , telangana; } </script></body></html>
当脚本被执行时,它会生成一个输出,其中包含一个填充有文本的地址字段的文本区域,以及一个点击更改按钮if the user clicks on the button, the text in the textarea gets changed.
example 3 的中文翻译为:示例3<p>让我们考虑另一个例子,我们正在使用textarea标签</p><!doctype html><html><head> <title>html textarea tag</title></head><body> <form action = /cgi-bin/hello_get.cgi method = get> enter subjects <br/> <textarea rows = 5 cols = 50 name = description></textarea> <input type = submit value = submit /> </form></body></html>
when the script gets executed, the output window will pop up, providing the input type for textara along with a submit button.
以上就是我们如何在html中显示文本区域?的详细内容。
其它类似信息

推荐信息