it is in a form in this case, two groups of fields have a dependency on each other. So there are two field groups (fieldset), the first with an input: a text area and a pull-down (select) menu, the second fieldset contains only a pulldown (select) menu. If one now on the second pull down menu which selects (Javascript event "onchange"), so, all three fields (input, select and text area) are emptied from the first fieldset.
This is done as follows:
- First, the form must be given a name:
\u0026lt;form name="form">
- The first group of fields has a text area, an input and a pull box and is as follows:
\u0026lt;textarea name = "impressive address" cols = "21" rows = "3" style = " width: 250px ;">\u0026lt;/ textarea>
\u0026lt;input type="text" name="EindruckKonto" size="25" style="width: 250px;">
\u0026lt; select name = "A4_mit_ES" style = "width: 366px;>
\u0026lt;option value="Bitte select Please select aus"> \u0026lt;option You off \u0026lt;/ option>
value="3000 Ex."> 3000 Ex \u0026lt;/ option>
\u0026lt;option value="5000 Ex."> 5000 Ex \u0026lt;/ select option>
\u0026lt;/>
- The second group of fields, will receive a selection (select) with 3 options:
name="A4-ES-105">
\u0026lt;select
\u0026lt;option value="Bitte select aus"> Please select \u0026lt;/ option>
\u0026lt;option value="5000 Ex."> 5000 Ex \u0026lt;/ option>
\u0026lt;option value="10000 Ex."> 6000 copies \u0026lt;/ option>
\u0026lt; ; / select>
- Now there is the condition that if one chooses in the second group from the pull a different value, the input, the text area drained field using Javascript and the pull down menu are set to the initial value:
We add the pulldown menu, select the days following attribute to:
onchange
order now Fields to empty, we fill in the following attribute values:
JavaScript
document. form. impressive account value ='';.
document. form. impressive address value ='';.
It is form for the form name and impressive account and impressive address for the fields name.
used To reset now the pulldown menu (Select) to the initial value to document the following command
. form. . A4_mit_ES selectedIndex = 0;
This form is for the form name and A4_mit_ES for the field name.
composite of this looks as follows:
\u0026lt;select name = "A4-ES-105" onChange = "JavaScript: document.form.EindruckKonto.value =''; document.form.EindruckAdresse.value = ''; document.form.A4_mit_ES.selectedIndex = 0; ">
Total HTML - Code:
\u0026lt;form method =" post "action =" action.php "name = "form">
\u0026lt;fieldset title="Adresse">
\u0026lt;legend> first Address \u0026lt;/ legend>
\u0026lt;textarea name="EindruckAdresse" cols="21" rows="3" style="width: 250px;"> \u0026lt;/ textarea>
\u0026lt;input type = " text "name =" impressive account "size =" 25 "style =" width: 250px;>
\u0026lt;select name="A4_mit_ES" style="width: 366px;">
\u0026lt;option value = "Please select"> Please select \u0026lt;/ option>
\u0026lt;option value="3000 Ex."> 3000 Ex \u0026lt;/ option>
\u0026lt;option value="5000 Ex."> 5000 Ex \u0026lt;/ option>
\u0026lt;/ select> ;
\u0026lt;/ fieldset>
\u0026lt;fieldset title="Adresse 2">
\u0026lt;legend> second Address \u0026lt;/ legend>
\u0026lt;select name = "A4-ES-105" onChange = "JavaScript: document.form.EindruckKonto.value =''; document.form.EindruckAdresse.value =''; document.forms . A4_mit_ES.selectedIndex = 0; ">
\u0026lt;option value="Bitte select aus"> Please select \u0026lt;/ option>
\u0026lt;option value="5000 Ex."> 5000 Ex \u0026lt;/ option>
\u0026lt;/ select> \u0026lt;option value="10000 Ex."> 6000 copies \u0026lt;/ option>
\u0026lt;/ fieldset>
\u0026lt;/ form>
0 comments:
Post a Comment