radio or checkbox

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #16
    when i click on the heckbox it reloads the page and just writes the sum on a blank page
    I’d need something to see to make a qualified comment.

    Comment

    • colinod
      Contributor
      • Nov 2007
      • 347

      #17
      if you men the actual pages try

      Yakety Yak is a leading Voice Over Agency based in London. We specialise in Voice Casting, Celebrity Voiceovers as well as English and International voices.


      check some boxes and then go to the national page thats where i am trying things at the moment

      Comment

      • colinod
        Contributor
        • Nov 2007
        • 347

        #18
        sorted it change the
        Code:
        document.write("<%= runtotal %>")
        to
        Code:
        "<%= runtotal %>"
        i am now getting object does'nt support this propert or method in line 36 char 3

        Code:
        document.getElementById('total').value = sum.toFixed(2);

        Comment

        • Dormilich
          Recognized Expert Expert
          • Aug 2008
          • 8694

          #19
          i am now getting object does'nt support this propert or method in line 36 char 3
          well, you try to access a Number method on a String object. this does not work.

          Comment

          • colinod
            Contributor
            • Nov 2007
            • 347

            #20
            i think you have lost me there!!!

            Comment

            • Dormilich
              Recognized Expert Expert
              • Aug 2008
              • 8694

              #21
              try the following before that line
              Code:
              alert(typeof sum);

              Comment

              • colinod
                Contributor
                • Nov 2007
                • 347

                #22
                i gather this is string because of the fact i have made it from asp variables is there a way of converting it?

                I have tried adding parsfloat('sum' "); in the line before but it still says its a string

                Comment

                • Dormilich
                  Recognized Expert Expert
                  • Aug 2008
                  • 8694

                  #23
                  because the function is called parseFloat(). you could also leave off the quotation marks, would be the same.

                  Comment

                  • colinod
                    Contributor
                    • Nov 2007
                    • 347

                    #24
                    sorry that was my typing in the forum, what i actually have is theis

                    parseFloat('sum ');
                    alert(typeof sum);

                    but it still says its a string, i have tried it without the quotes also

                    Comment

                    • Dormilich
                      Recognized Expert Expert
                      • Aug 2008
                      • 8694

                      #25
                      you are aware, that 'sum' is not the variable?

                      Comment

                      • colinod
                        Contributor
                        • Nov 2007
                        • 347

                        #26
                        no i was not, just cant get this javascript, but am slowly learning, weird that i know asp though??

                        Comment

                        • Dormilich
                          Recognized Expert Expert
                          • Aug 2008
                          • 8694

                          #27
                          you don't want me to tell what I think of ASP ...

                          Comment

                          • colinod
                            Contributor
                            • Nov 2007
                            • 347

                            #28
                            probably the same as me and javascript, what is the variable i really thought sum held the total

                            Comment

                            • Dormilich
                              Recognized Expert Expert
                              • Aug 2008
                              • 8694

                              #29
                              the variable is named sum just not within quotation marks, that would be then a string literal.

                              Comment

                              • colinod
                                Contributor
                                • Nov 2007
                                • 347

                                #30
                                thanks for your help with all that, finally got it working and moving totals from page to page, i still have the same problem if you reset the form its not a problem but i was going to add a button to reset the total also but that does not want to work

                                the code for adding is now

                                Code:
                                function UpdateCost() {
                                  var sum = <%= runtotal %>;
                                  var gn, elem;
                                  for (i=0; i<5; i++) {
                                    gn = 'id'+i;
                                    elem = document.getElementById(gn);
                                    if (elem.checked == true) { sum += Number(elem.value); }
                                  }
                                  parseFloat(sum);
                                  document.getElementById('total').value = sum.toFixed(2);
                                }
                                i have a feeling i have just gone round in a circle to end up with the same problem though

                                Comment

                                Working...