Html Radio Button

Radio Button in Html language:

Radiobutton used when you want to select one option from a set of given option.
How to define RadioButton on Html page: 



<input type="radio" name="browser"  value="Button1"/> Button1<br>

Here in this declaration we conside type of input tag, name define group and value define which store in the value field of given input tag.
Radio button group work as like collection of radio buttons. There are many properties for design radio button user friendly. 

Radio Button  select option:

<select>

  <optgroup label="** ">

    <option value="**** ">**** </option>

    ....  </optgroup>

  <optgroup label="#### ">    ...

  </optgroup>

</select>

This define how to give the selection option in Radio button

 

Radio button JavaScript:

 

<script type="text/javascript">
    function check(browser){
        document.forms[0].answer.value=browser
    }
</script>
This Script gives the value of selected button.and print it on form text field.

 

RadioButton Properties:


  • Id: Use unique key for Access to control.
  • Name: For use Association more than one .
  • Value: define what you display with html button.

Other back color, border color, border style, font names, font bold, font italic, fore color (text color) and many more property.

Example Radiobutton on html page:

In this Example we consider three buttons in a same group. And take a text field for display selected button value.

<html>
<head>
<script type="text/javascript">
    function check(browser){
        document.forms[0].answer.value=browser
    }
</script>

</head>

<body>
<form>Select which browser is your favorite:<br>
<input type="radio" name="browser" onclick="check(this.value)"
            value="Button1"> Button1<br>
<input type="radio" name="browser" onclick="check(this.value)"
            value=" Button2"> Button2<br>
<input type="radio" name="browser" onclick="check(this.value)"
            value=" Button3"> Button3<br>
<br>
<input type="text" name="answer" size="20">
</form>
</body>

</html>
Html Radiobutton
Html Radio button


Other Post :


Comments

Popular posts from this blog