HTML DOM 文本区域行属性
HTML DOM 文本区域行返回并且修改了 HTML 文档中文本区域元素的行属性的值。
语法
以下为语法 −
1. 返回行
object.rows
2. 添加行
object.rows = “number”
让我们看一个关于 HTML DOM 文本区域行属性的示例
示例
<!DOCTYPE html>
<html>
<style>
body {
color: #000;
background: lightseagreen;
height: 100vh;
}
.btn {
background: #db133a;
border: none;
height: 2rem;
border-radius: 2px;
width: 40%;
display: block;
color: #fff;
outline: none;
cursor: pointer;
}
</style>
<body>
<h1>DOM Textarea rows Property Demo</h1>
<textarea>Hi! I'm a textarea element in an HTML document with some dummy text.</textarea>
<button onclick="set()" class="btn">Set Rows = 8</button>
<script>
function set() {
document.querySelector("textarea").rows = '8';
}
</script>
</body>
</html>输出

点击 “设置行 = 8” 按钮来将行属性的值设置为 50。

广告
数据结构
网络
RDBMS
操作系统
Java
iOS
HTML
CSS
Android
Python
C 编程
C++
C#
MongoDB
MySQL
Javascript
PHP