<select id="choose-first-unit" class="span-four" onchange="setInterval(recountvol(this), 1000)">
<option value="m3">cubic meters</option>
<option value="cm3">cubic centimeters/milliliters</option>
<option value="dm3">cubic decimeters/litres</option>
<option value="hl">hectolitres</option>
<option value="cl">centilitres</option>
</select>
<select id="choose-second-unit" class="bum" onchange="setInterval(recountvol2(this), 1000)">
<option value="m3-2">cubic meters</option>
<option value="cm3-2">cubic centimeters/millilitres</option>
<option value="dm3-2">cubic decimeters/litres</option>
<option value="hl-2">hectolitres</option>
<option value="cl-2">centilitres</option>
</select>
I'm trying to create a volume converter with javascript and I would like to create a function, which would start converting without any "convert/equals" button. I have two select elements to choose the units and then onchange function which does what I want, but only "onchange". I tried infinite loop, but that was of course laggy, so I tried everything possible with setInterval() function, but I'm out of ideas, the function always executes only once, so I'm writing here.
important HTML:
<select id="choose-first-unit" class="span-four" onchange="setInterval(recountvol(this), 1000)">
<option value="m3">cubic meters</option>
<option value="cm3">cubic centimeters/milliliters</option>
<option value="dm3">cubic decimeters/litres</option>
<option value="hl">hectolitres</option>
<option value="cl">centilitres</option>
</select>
<select id="choose-second-unit" class="bum" onchange="setInterval(recountvol2(this), 1000)">
<option value="m3-2">cubic meters</option>
<option value="cm3-2">cubic centimeters/millilitres</option>
<option value="dm3-2">cubic decimeters/litres</option>
<option value="hl-2">hectolitres</option>
<option value="cl-2">centilitres</option>
</select>
I think that the JS is OK, because the function is executed, but only once, so I am asking: Where in the HTML or JS should I implement the setInterval(), what should I change inside it (the setInterval), or it's by wrong passed parameter (and if yes, can you correct them for me please)?
If that's a bad question for stackoverflow, I'm sorry, I'm new here.