15,960,736 members
1.00/5 (1 vote)
See more:
function calculate( ) {

var A = document.getElementById('A').value;
var B = document.getElementById('B').value;
var C = document.getElementById('C');
var C = A * B / 100;
C.value = myC;

var D = document.getElementById('D').value;
var E = document.getElementById('E');
var E = C - D * C / 100;
E.value = myE;

}

function calculate1( ) {

var A = document.getElementById('A').value;
var B = document.getElementById('B').value;
var C = document.getElementById('C');
var C = A * B / 100;
C.value = myC;

var D = document.getElementById('D').value;
var E = document.getElementById('E');
var E = C - D * C / 100;
E.value = myE;

}

What I have tried:

I am trying get value of a simple table but not get it my code is here..
Both script having 1 plus 1 function on same document.
c is RESULT VALUE, D IS DISCOUNT value AND E is the place of result of both function.
Posted
Updated 20-Nov-16 0:41am

## Solution 1

Very confusing!
1. Why two functions? They are doing the exact same thing from what we can see.
2. What are myC and myE? Did you mean:
```var myC = A * B / 100;
C.value = myC;```

and
```var myE = myC  - D * myC  / 100;
E.value = myE; ```

## Solution 2

Your code is very confuse, I can't even guess what it is supposed to do.
Please state the problem you have.

You should learn to use the debugger as soon as possible. Rather than guessing what your code is doing, It is time to see your code executing and ensuring that it does what you expect.

The debugger allow you to follow the execution line by line, inspect variables and you will see that there is a point where it stop doing what you expect.
Debugger - Wikipedia, the free encyclopedia[^]
Mastering Debugging in Visual Studio 2010 - A Beginner's Guide[^]

The debugger is here to show you what your code is doing and your task is to compare with what it should do.
There is no magic in the debugger, it don't find bugs, it just help you to. When the code don't do what is expected, you are close to a bug.