Link to home
Start Free TrialLog in
Avatar of Ryan Bayne
Ryan BayneFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Initiate Code - Recalculating Page

I'm trying to learn some code I find advanced. Anyhelp is education LOL

Am I correct in saying that this activates the reCal function?
function init(){

  elem = document.forms[0].elements;

  for(var i=0;i<elem.length;i++){

    if(elem[i].type=="text"){

      elem[i].onkeyup = function(){reCalc(this)};

    }

And this is the reCalc function?

function reCalc(theField){

  var theForm = theField.form;

  if(theField.name.indexOf("Charge")==0){

    var fldVal = theField.value.replace(/[^\d\.]/g,"");

    if(fldVal!=theField.value) theField.value = fldVal;

    if(theField.name=="ChargeYear"){

      chgDay = fldVal/365;

      theForm.ChargeMonth.value = (fldVal/12).toFixed(2);

      theForm.ChargeDay.value = (fldVal/365).toFixed(2);
        
      
    }

OR AM I WRONG?

If you need to see all the code please go here...
http://www.rentacoder.com/RentACoder/misc/BidRequests/ShowBidRequest.asp?lngBidRequestId=276505
ASKER CERTIFIED SOLUTION
Avatar of GrandSchtroumpf
GrandSchtroumpf

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of GrandSchtroumpf
GrandSchtroumpf

<:°)