Hi, I have 5 Numeric fields in my from, I am using onkeyup to check for numeric values only, now I have a total field also. I would like to have a sum of the values entered in the 5 fields to be shown automatically on this total field. How to do this, please help.

6 Years
Discussion Span
Last Post by benhowdle89

You need to get the display element by either go through DOM (parentElement.subelementName...) or directly access via the element ID (document.getElementById(elementId)). Then assign/append the value to the display element's value or innerHTML depending on what type of your display element (input/textarea -> value, div/span -> innerHTML). If you still does not know how to do it, please post your code portion.

Edited by Taywin: n/a


Below is the code i used to apply conditional formatting to a table i was pulling from a mySQL database. If the value in the cell was bigger or smaller than 200 i would flag it a different background colour. I think you might be able to adapt this for your application!

<script type="text/javascript">
$(document).ready(function() {
var refreshId = setInterval(function() {

         $("#recent tr:not(:first)").each(function() { 
             var tempresult = $(this).find("td:nth-child(3)").text();
             var setpoint = 200;
             if (tempresult < setpoint){
                 $(this).find("td:nth-child(3)").css("background-color", "#00FF00");
             else if(tempresult > setpoint){
                 $(this).find("td:nth-child(3)").css("background-color", "#FF0000");
				 $(this).find("td:nth-child(3)").css("color", "white");

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.