I have keypad page to apply the vale in a text input, with simple JS code
when I'm trying to apply the value, getting the error at Line 24 of JS code
Uncaught TypeError: Cannot read property 'value' of undefined at this line of my JS code
keypadPhoneNum.jsp page
keypadControl.js page
phone.jsp
well the main page is contain text input to apply the value of keypad
That means that currField is null at that point. Use the browser's debugger to set breakpoints and step through the code to see where things aren't going as you expected.
Which means your selection code to find the element is wrong. The way you are doing it is very antiquated and hasn't been used for years because it's fragile and frequently results in failures.
Why aren't you using jQuery to make this all much easier?
Accidentally works, doesn't mean that it's right. What you are doing is fragile and likely to break at some point when the page is modified. Good luck to the next person who has to maintain the mess.