HTML DOM propriétés du formulaire Button
Définition et utilisation
former propriété renvoie à la forme qui contient les références de bouton.
Si vous incluez le bouton, elle retourne un objet de forme, si non compris dans le bouton, elle renvoie null.
grammaire
buttonObject.form
support du navigateur
Tous les principaux navigateurs supportent forme la propriété.
Exemples
Exemples
L'exemple suivant renvoie forment le bouton appartient id:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>本教程(w3big.com)</title>
</head>
<body>
<form id="form1">
<button id="button1" type="button">点我!</button>
</form>
<p>含有按钮的表单的ID:
<script>
document.write(document.getElementById("button1").form.id);
</script></p>
</body>
</html>
<html>
<head>
<meta charset="utf-8">
<title>本教程(w3big.com)</title>
</head>
<body>
<form id="form1">
<button id="button1" type="button">点我!</button>
</form>
<p>含有按钮的表单的ID:
<script>
document.write(document.getElementById("button1").form.id);
</script></p>
</body>
</html>
Essayez »
Bouton Objets