源代码:
下载代码
AI 编程工具
点击运行
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>菜鸟教程(runoob.com)</title> </head> <body> <textarea id="myTextarea"> Runoob</textarea> <p>点击按钮获取 textarea 元素的高度。</p> <button type="button" onclick="myFunction()">点我</button> <p id="demo"></p> <script> function myFunction() { document.getElementById("myTextarea").style.height = "250px"; } </script> </body> </html>
运行结果: