?
Solved

Initiate Code - Recalculating Page

Posted on 2005-04-29
2
Medium Priority
?
179 Views
Last Modified: 2010-04-09
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
0
Comment
Question by:Ryan Bayne
  • 2
2 Comments
 
LVL 30

Accepted Solution

by:
GrandSchtroumpf earned 200 total points
ID: 13899217
> Am I correct in saying that this activates the reCal function?
Not exactly, it tells the browser to call the reCal function when any of the form elements receive a "keyup" event.
Note that there is a javascript section for this type of questions: http://www.experts-exchange.com/Web/Web_Languages/JavaScript/
0
 
LVL 30

Expert Comment

by:GrandSchtroumpf
ID: 13899971
<:°)
0

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
There's never been a better time to become a computer scientist. Employment growth in the field is expected to reach 22% overall by 2020, and if you want to get in on the action, it’s a good idea to think about at least minoring in computer science …
In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

621 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question