Sorry if this question sounds pretty stupid;
My situation is that I have three input sliders in my HTML; then, within the <body>
tag, after the inputs, I have some JavaScript accessing the data. The unfortunate part is that I want the embedded JavaScript to be run via an onClick
event; but, the embedded JavaScript is not one big function, so I'm rather stumped. Does anybody have a solution? Here is my code:
<html>
<body>
<form>
</form>
<form>
<input type="range" id="ocAc"></input>
<input type="range" id="ocBc"></input>
<input type="range" id="ocCc"></input>
</form>
<script>
var oc1 = document.getElementById("ocAc").value / 100;
var oc2 = document.getElementById("ocBc").value / 100;
var oc3 = document.getElementById("ocCc").value / 100;
var total = oc1+oc2+oc3;
//do stuff
</script>