HTML DOM Radio form properties
Definition and Usage
form property returns to the form that contains the button references.
If successful, the property returns a form object.
grammar
radioObject.form
Browser Support
All major browsers support form properties
Examples
Examples
The following example will return the radio button belongs to the form id:
<! DOCTYPE html>
<Html>
<Head>
<Meta charset = "utf-8">
<Title> This tutorial (w3big.com) </ title>
<Script>
function displayResult () {
var x = document.getElementById ( "red") form.id.;
alert (x);
}
</ Script>
</ Head>
<Body>
<Form id = "form1">
Which color do you prefer? <br>
<Input type = "radio" name = "colors" id = "red"> red <br>
<Input type = "radio" name = "colors" id = "blue"> Blue <br>
<Input type = "radio" name = "colors" id = "green"> green
</ Form>
<Button type = "button" onclick = "displayResult ()"> id form display belongs </ button>
</ Body>
</ Html>
<Html>
<Head>
<Meta charset = "utf-8">
<Title> This tutorial (w3big.com) </ title>
<Script>
function displayResult () {
var x = document.getElementById ( "red") form.id.;
alert (x);
}
</ Script>
</ Head>
<Body>
<Form id = "form1">
Which color do you prefer? <br>
<Input type = "radio" name = "colors" id = "red"> red <br>
<Input type = "radio" name = "colors" id = "blue"> Blue <br>
<Input type = "radio" name = "colors" id = "green"> green
</ Form>
<Button type = "button" onclick = "displayResult ()"> id form display belongs </ button>
</ Body>
</ Html>
try it"
Radio Objects