SitePoint Sponsor

User Tag List

Results 1 to 25 of 47

Threaded View

  1. #1
    SitePoint Enthusiast
    Join Date
    Nov 2012
    0 Post(s)
    0 Thread(s)

    Javascript Calculations not working in IE8 and below Pleeeeease Help

    This must be the most commonly asked question yet I could not find the answer to my problem.

    I have a script to perform some simple calculations on my site and everything works fine on all browsers, but not in IE8 or below. I searched the whole world for an answer, but couldn't find it, but then I saw one of you solving a similar problem here. So I thought I would ask.

    I have this following as the DOCTYPE
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "">
    <html lang="en-US">
    The script stopped working also when I change to strict.dtd.
    Here is the script in question:
    <script language="javascript" type="text/javascript">
    function TotalOrder()
    //document.getElementById('itemsToTotal').innerHTML = "";
    var A = parseInt(document.getElementById('FR1').value) || 0;
    var B = parseInt(document.getElementById('FR2').value) || 0;
    var C = parseInt(document.getElementById('FR3').value) || 0;
    var D = parseInt(document.getElementById('SR1').value) || 0;
    var E = parseInt(document.getElementById('SR2').value) || 0;
    var orderplaced = A + B + C + D + E;
    document.getElementById('ORDERPLACED').innerHTML = orderplaced;
    // -->
    Supposed to add the values of few fields and show the total items selected. But all I get is a zero for the value. It is doing something but the answer is always Zero.

    I am using text/javascript.
    Should I change the single quotes to double quotes for FR1,2 etc and for ORDERPLACED id tags?

    Any help would be greatly appreciated. I can send you the complete code and link in a separate email.

    Thank you.
    Last edited by Shyflower; Nov 20, 2012 at 10:11.


Posting Permissions

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