Difference between revisions of "Test"
From Fellrnr.com, Running tips
User:Fellrnr (User talk:Fellrnr | contribs) |
User:Fellrnr (User talk:Fellrnr | contribs) |
||
Line 5: | Line 5: | ||
var trimps=new Array(); | var trimps=new Array(); | ||
var total = 0; | var total = 0; | ||
− | for(i=1; i< | + | for(i=1; i<=5; i++) |
{ | { | ||
− | + | if(document.getElementById('0'+i).checked) | |
− | + | { | |
− | + | total += document.getElementById('0'+i).value; | |
+ | } | ||
} | } | ||
− | + | document.getElementById('Total').innerHTML = "Total: " + total; | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | document.getElementById('Total').innerHTML = "Total | ||
− | |||
} | } | ||
</script> | </script> | ||
Line 37: | Line 28: | ||
<tr> | <tr> | ||
<td>I slept well last night</td> | <td>I slept well last night</td> | ||
− | <td><input type="radio" name="slept" value="1" /></td> | + | <td><input type="radio" name="slept" value="1" id="01"/></td> |
− | <td><input type="radio" name="slept" value="2" /></td> | + | <td><input type="radio" name="slept" value="2" id="02"/></td> |
− | <td><input type="radio" name="slept" value="3" /></td> | + | <td><input type="radio" name="slept" value="3" id="03"/></td> |
− | <td><input type="radio" name="slept" value="4" /></td> | + | <td><input type="radio" name="slept" value="4" id="04"/></td> |
− | <td><input type="radio" name="slept" value="5" /></td> | + | <td><input type="radio" name="slept" value="5" id="05"/></td> |
</tr> | </tr> | ||
</table> | </table> | ||
<label id="Total">Total:</label><br/> | <label id="Total">Total:</label><br/> | ||
+ | <input type="button" value="Calculate" onclick="doCalc()"/> | ||
</form> | </form> | ||
</html> | </html> |
Revision as of 20:03, 6 March 2012