liamloveslearning Posted May 23, 2011 Share Posted May 23, 2011 Hi all, having trouble with a simple equation, my javascript is returning undefined when I try to multiply 2 variables on keyup, my code is <html> <head> <script> function functionCalc() { // Content Minutes var conMin = document.getElementById('cMin'); var test = 10; // Service Levels var priorityMega = 0.84; var priorityUrgent = 0.67; var standardJob = 0.56; var scheduledJob = 0.28; var lightpassJob = 0.14; var total = conMin + test; document.getElementById("estDiv").innerHTML=total.value; } </script> </head> <body> <input type='text' id='cMin' onKeyUp="functionCalc()" /> <div id="estDiv"></div> </body> </html> Can anybody see why? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/237197-javascript-undefined-onkeyup/ Share on other sites More sharing options...
liamloveslearning Posted May 23, 2011 Author Share Posted May 23, 2011 whoops, i was total was a variable so didn'r need the .value at the end! Quote Link to comment https://forums.phpfreaks.com/topic/237197-javascript-undefined-onkeyup/#findComment-1218986 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.