vendredi 23 juin 2017

input form limit one slider based on other sliders value

Is there a way to link two forms or two sliders? First here is my code.

<form>
       <input type="range" name="amountRange" align="right" min="1" max="114" value="1" oninput="this.form.amountInput.value=this.value" />
        <input type="number" style="font-size:12pt; height:40px; width:55px;" name="amountInput"  min="1" max="114" value="1" oninput="this.form.amountRange.value=this.value"/> 
    </form>
    <form>
        <input type="range" name="amountRange2" align="right" min="1"  max="114" value="1" oninput="this.form.amountInput2.value=this.value" />
        <input type="number" style="font-size:12pt; height:40px; width:55px;" name="amountInput2"  min="1" max="114" value="1" oninput="this.form.amountRange2.value=this.value"/></h4>
    </form>

Both sliders here have a max of 114 I want the max of slider2 to change for whatever value slider 1 is set at.

So for example, if slider1's value was set to 10, then I want the second sliders max to be 90

and if slider1 was set on 20, I want slider2 max to be 50

and if slider1 was set on 30, I want slider2 max to be 80 and so forth

Should I use if/else or switch/case/break?

Sorry guys still a beginner.... Thanks from now

Aucun commentaire:

Enregistrer un commentaire