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:使用JavaScript
Considering 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中显示文本区域?的详细内容,更多请关注双恒网络其它相关文章!
2. 分享目的仅供大家学习和交流,您必须在下载后24小时内删除!
3. 不得使用于非法商业用途,不得违反国家法律。否则后果自负!
4. 本站提供的源码、模板、插件等等其他资源,都不包含技术服务请大家谅解!
5. 如有链接无法下载、失效或广告,请联系管理员处理!
6. 本站资源售价只是赞助,收取费用仅维持本站的日常运营所需!
7. 如遇到加密压缩包,请使用WINRAR解压,如遇到无法解压的请联系管理员!
8. 精力有限,不少源码未能详细测试(解密),不能分辨部分源码是病毒还是误报,所以没有进行任何修改,大家使用前请进行甄别
9.本站默认解压密码为:www.sudo1.com
本站提供的一切软件、教程和内容信息仅限用于学习和研究目的。
不得将上述内容用于商业或者非法用途,否则,一切后果请用户自负。
本站信息来自网络收集整理,版权争议与本站无关。您必须在下载后的24个小时之内,从您的电脑或手机中彻底删除上述内容。
如果您喜欢该程序和内容,请支持正版,购买注册,得到更好的正版服务。
我们非常重视版权问题,如有侵权请邮件与我们联系处理。敬请谅解!
云资源网 » 我们如何在HTML中显示文本区域?
常见问题FAQ
- 免费下载或者VIP会员专享资源能否直接商用?
- 本站所有资源版权均属于原作者所有,这里所提供资源均只能用于参考学习用,请勿直接商用。若由于商用引起版权纠纷,一切责任均由使用者承担。更多说明请参考 VIP介绍。
- 提示下载完但解压或打开不了?
- 你们有qq群吗怎么加入?