Propiedad Valor HTML DOM Textarea
objeto textarea
Definición y Uso
conjuntos de propiedades de valor o devuelve el texto del área de texto.
gramática
Establecer el valor de la propiedad:
textareaObject.value="text"
Devuelve el valor de la propiedad:
textareaObject.value
值 | 描述 |
---|---|
text | 指定文本框的内容 |
Soporte para el navegador
Todos los principales navegadores soportan valor del atributo
Ejemplos
Ejemplos
Pop-up elementos de texto de área de texto:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>本教程(w3big.com)</title>
<script>
function displayResult()
{
alert(document.getElementById("myTextarea").value);
}
</script>
</head>
<body>
<textarea id="myTextarea" cols="20">
在本教程,你可以学多很多编程的基础知识,包括 HTML, XML, SQL, ASP, 和 PHP 等各种前端内容。
</textarea>
<br>
<button type="button" onclick="displayResult()">弹出 textarea 元素的文本</button>
</body>
</html>
<html>
<head>
<meta charset="utf-8">
<title>本教程(w3big.com)</title>
<script>
function displayResult()
{
alert(document.getElementById("myTextarea").value);
}
</script>
</head>
<body>
<textarea id="myTextarea" cols="20">
在本教程,你可以学多很多编程的基础知识,包括 HTML, XML, SQL, ASP, 和 PHP 等各种前端内容。
</textarea>
<br>
<button type="button" onclick="displayResult()">弹出 textarea 元素的文本</button>
</body>
</html>
objeto textarea