bentuk sifat HTML DOM Textarea
Definisi dan Penggunaan
bentuk properti mengembalikan area teks yang berisi referensi ke bentuk.
Jika berhasil, properti ini mengembalikan sebuah objek bentuk.
tatabahasa
textareaObject.form
Dukungan Browser
Semua browser utama mendukung sifat bentuk
contoh
contoh
Contoh ini mengembalikan bidang bentuk teks milik id:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>本教程(w3big.com)</title>
<script>
function displayResult()
{
var x=document.getElementById("myTextarea").form.id;
alert(x);
}
</script>
</head>
<body>
<form id="form1">
<textarea id="myTextarea" cols="20">
在本教程,你可以学多很多编程的基础知识,包括 HTML, XML, SQL, ASP, 和 PHP 等各种前端内容。
</textarea>
</form>
<br>
<button type="button" onclick="displayResult()">显示 form 的 id</button>
</body>
</html>
<html>
<head>
<meta charset="utf-8">
<title>本教程(w3big.com)</title>
<script>
function displayResult()
{
var x=document.getElementById("myTextarea").form.id;
alert(x);
}
</script>
</head>
<body>
<form id="form1">
<textarea id="myTextarea" cols="20">
在本教程,你可以学多很多编程的基础知识,包括 HTML, XML, SQL, ASP, 和 PHP 等各种前端内容。
</textarea>
</form>
<br>
<button type="button" onclick="displayResult()">显示 form 的 id</button>
</body>
</html>
objek textarea