HTML DOM bentuk ulang properti
Definisi dan Penggunaan
bentuk properti mengembalikan tombol reset pada formulir yang berisi referensi.
Jika berhasil, properti mengembalikan sebuah objek bentuk.
tatabahasa
resetObject.form
Dukungan Browser
Semua browser utama mendukung sifat bentuk
contoh
contoh
Tampilan tombol reset ke form id Anda:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>本教程(w3big.com)</title>
<script>
function displayResult(){
var x=document.getElementById("reset1").form.id;
alert(x);
}
</script>
</head>
<body>
<form id="form1">
Email: <input type="text" id="email">
<input type="reset" id="reset1">
</form>
<button type="button" onclick="displayResult()">显示所属的表单ID</button>
</body>
</html>
<html>
<head>
<meta charset="utf-8">
<title>本教程(w3big.com)</title>
<script>
function displayResult(){
var x=document.getElementById("reset1").form.id;
alert(x);
}
</script>
</head>
<body>
<form id="form1">
Email: <input type="text" id="email">
<input type="reset" id="reset1">
</form>
<button type="button" onclick="displayResult()">显示所属的表单ID</button>
</body>
</html>
Coba »
benda ulang