Área de texto HTML DOM atributo de nombre
objeto textarea
Definición y Uso
nombrar los conjuntos de propiedades o devuelve el nombre del área de texto.
gramática
Establecer atributo de nombre:
textareaObject.name="text"
Devuelve el atributo de nombre:
textareaObject.name
Consejo: propiedad de nombreno tiene ningún valor predeterminado.
值 | 描述 |
---|---|
text | 指定的textarea的名称 |
Soporte para el navegador
Todos los principales navegadores soportan nombre de atributo
Ejemplos
Ejemplos
En este ejemplo se establece el nombre de área de texto:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>本教程(w3big.com)</title>
<script>
function displayResult()
{
var x=document.getElementById("myTextarea").name;
alert(x);
}
</script>
</head>
<body>
<textarea id="myTextarea" name="txt1" cols="20">
在本教程,你可以学多很多编程的基础知识,包括 HTML, XML, SQL, ASP, 和 PHP 等各种前端内容。
</textarea>
<br>
<button type="button" onclick="displayResult()">显示 textarea name 属性值</button>
</body>
</html>
<html>
<head>
<meta charset="utf-8">
<title>本教程(w3big.com)</title>
<script>
function displayResult()
{
var x=document.getElementById("myTextarea").name;
alert(x);
}
</script>
</head>
<body>
<textarea id="myTextarea" name="txt1" cols="20">
在本教程,你可以学多很多编程的基础知识,包括 HTML, XML, SQL, ASP, 和 PHP 等各种前端内容。
</textarea>
<br>
<button type="button" onclick="displayResult()">显示 textarea name 属性值</button>
</body>
</html>
objeto textarea