moses12345 wrote:
…insted of document.all['control'] I used getElementByID
No, you did not. Did you see you own code? You still use
document.all
, which is not a legal or standard property. Also, you calculate in several places, but you should calculate it only once. You can calculate the DOM element (
textarea
control, in this case), in the very first line of the function
counter
or pass it as a parameter of this function, and calculate the control reference once, in the caller, using
document.getElementById
(which is
not document.getElementByID
, look thoroughly).
You also need to answer the questions I asked in my comment to the question, first of all, answer for yourself. You need to add a loop, iterate throw the control's
value
, increment some character counter. You also need to return the counter value. You don't try to do anything of the above.
—SA