www.webdeveloper.com
Results 1 to 3 of 3

Thread: JS calculation

  1. #1
    Join Date
    Mar 2014
    Posts
    4

    JS calculation

    Hi

    i am developing a web-based system involving JS calculation (ADD operator) but i can't still figure this out.. can anyone help me out here

    function jumkerusi()
    {


    var a = parseInt(document.forms[0].jumbyrsofa.value);
    var b = parseInt(document.forms[0].jumbyrvip.value);
    var c = parseInt(document.forms[0].jumbyrplastik.value);


    document.forms[0].jumbyrkerusi.value = parseInt(a+b+c);

    }

  2. #2
    Join Date
    Mar 2005
    Location
    Behind you...
    Posts
    962
    Could you provide any additional info such as what the code actually does (the result) and what you want it to do? Any examples such as what data you put into the fields will also be useful.

    At a glance I can't say I see any real problems with your code, but again I don't know what values you are actually putting in, and what the result you're getting is either.
    "Given billions of tries, could a spilled bottle of ink ever fall into the words of Shakespeare?"

  3. #3
    Join Date
    Feb 2014
    Location
    Canada
    Posts
    155
    By using parseInt, it makes me suspect that a, b and c are Strings instead of numbers, however, without seeing the HTML or you telling us what is happening (i.e. console errors), we cant help.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles