源代码:
下载代码
AI 编程工具
点击运行
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>菜鸟教程(runoob.com)</title> </head> <body> <textarea id="myTextarea" rows="4" cols="50"> Runoob</textarea> <p>点击按钮修改文本框 textarea 的行数(高度)。</p> <button type="button" onclick="myFunction()">点我</button> <script> function myFunction() { document.getElementById("myTextarea").rows = "10"; } </script> </body> </html>
运行结果: