<form> |
| <output>10</output> |
|
<form oninput="mm1.value=parseInt(aa.value)">
<output name="mm1" for="aa">30</output><br>
<input type="range" min="0" max="100" name="aa" id="aa" value="30">
</form> |
|
<form oninput="mm2.value=parseInt(bb.value)">
<input type="number" id="bb" name="bb" value="10" style="width:70px;">
<output name="mm2" for="bb">10</output>
</form> |
|
<form oninput="mm3.value=parseInt(cc.value)+parseInt(dd.value)">
<input type="range" id="cc" name="cc" value="10" style="width:100px;"> +
<input type="number" id="dd" name="dd" value="30" style="width:50px;"> =
<output name="mm3" for="cc dd">40</output>
</form>
|
</form>
|
- output 為被動元件,通常應搭配主動元件,才能顯示其功效
- oninput:將表單關連到某一元件
- parseint:將字串轉成整數
- for:對應到某些元件 (元件之間以空白間格)
|