Radios in JavaScript

How to create Radios in JavaScript:


In Radios to understand the Buttons (labeled buttons), which the user a can select.
It is not possible to have multiple Buttons to select. The "value" of the selected button is specified.

example:

the following form should appear on the website:

if you enter an amount in the "net"field is to be calculated by Selecting the "VAT"-amount of the respective tax.

Here you can test it.


the Following is the required code:

First, create the text box "net:". Since it is a "point account", you can create a simple text field. Here is the JavaScript converts the entered "text" automatically in Numbers. It also receives the name "net". This value is needed for the later calculation.
the first Radio is created Button. He is given the name "button". Of course, each x can be any Name used. The important thing is that both Radios have the same name, because you belong to a "group" that the user selects.
Then it specifies the "event" which should happen when Clicking on"". To do this, use the JavaScript command "onClick". In this case, 7% of the entered net amount is to be calculated.
Then creates the second Radio Button in the same way. Important: He must have the same name as the first Button. Only here the calculation of 19%.
the final step is To create the "result"text field. In this case, the "VAT" field. This field will then automatically output the result. Important: It must have the same name as in the calculation formula of the Radios. Here: VAT VAT.value(value).








Radios in JavaScript


How to create Radios in JavaScript:


In Radios to understand the Buttons (labeled buttons), which the user a can select.
It is not possible to have multiple Buttons to select. The "value" of the selected button is specified.

example:

the following form should appear on the website:

if you enter an amount in the "net"field is to be calculated by Selecting the "VAT"-amount of the respective tax.

Here you can test it.


the Following is the required code:

First, create the text box "net:". Since it is a "point account", you can create a simple text field. Here is the JavaScript converts the entered "text" automatically in Numbers. It also receives the name "net". This value is needed for the later calculation.
the first Radio is created Button. He is given the name "button". Of course, each x can be any Name used. The important thing is that both Radios have the same name, because you belong to a "group" that the user selects.
Then it specifies the "event" which should happen when Clicking on"". To do this, use the JavaScript command "onClick". In this case, 7% of the entered net amount is to be calculated.
Then creates the second Radio Button in the same way. Important: He must have the same name as the first Button. Only here the calculation of 19%.
the final step is To create the "result"text field. In this case, the "VAT" field. This field will then automatically output the result. Important: It must have the same name as in the calculation formula of the Radios. Here: VAT VAT.value(value).

Radios in JavaScript

How to create Radios in JavaScript:
Radios in JavaScript
Radios in JavaScript
Recommend to friends
  • gplus
  • pinterest

Comment

Leave comment

Rating