Is it possible to make a game like Magicsquare in Javascript?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • birdboy272
    New Member
    • May 2007
    • 10

    Is it possible to make a game like Magicsquare in Javascript?

    I would be cool if I could develop a 3 by 3 grid that all row, column and diagonals adds up to 15, using numbers ranging from 1 to 9.
    When click the "check sum button" this application should
    Sum up all rows, columns and diagonals and put the result in the corresponding box
    ... Use if/else to check if all the results are 15, and congratulates the user if the answer is correct.
    The name of text boxes should be named appropriately.
    bonus (1pt) make the program check/give error message so that user will enter each number 1~9 only once.
  • pbmods
    Recognized Expert Expert
    • Apr 2007
    • 5821

    #2
    Originally posted by birdboy272
    I would be cool if I could develop a 3 by 3 grid that all row, column and diagonals adds up to 15, using numbers ranging from 1 to 9.
    It sure would be. How far have you gotten?

    Comment

    • bergy
      New Member
      • Mar 2007
      • 89

      #3
      C'mon man, if you're trying to get us to do your homework at least take out lines like "bonus (1pt) make the program check..." You're not even asking a question you're asking for someone to do your work for you.

      Originally posted by birdboy272
      I would be cool if I could develop a 3 by 3 grid that all row, column and diagonals adds up to 15, using numbers ranging from 1 to 9.
      When click the "check sum button" this application should
      Sum up all rows, columns and diagonals and put the result in the corresponding box
      ... Use if/else to check if all the results are 15, and congratulates the user if the answer is correct.
      The name of text boxes should be named appropriately.
      bonus (1pt) make the program check/give error message so that user will enter each number 1~9 only once.

      Comment

      • acoder
        Recognized Expert MVP
        • Nov 2006
        • 16032

        #4
        Originally posted by bergy
        C'mon man, if you're trying to get us to do your homework at least take out lines like "bonus (1pt) make the program check..." You're not even asking a question you're asking for someone to do your work for you.
        You're absolutely right. That calls for my moderator hat...

        The experts on this site are more than happy to help you with your problems but they cannot do your assignment/program for you. Attempt the assignment/program yourself first and post questions regarding any difficulties you have or about a particular function of the code that you don't know how to achieve.

        Please read the Posting Guidelines and particularly the Coursework Posting Guidlines.

        Then when you are ready post a new question in this thread.

        MODERATOR

        Comment

        • birdboy272
          New Member
          • May 2007
          • 10

          #5
          Is it possible to make a game like Magicsquare in Javascript?

          Magic Square in Javascript?

          How would it be possible to make a game like magic square in JavaScript??



          heres what I want it to look like I just don't know how to work the function.


          <form name="zform">



          <table width="200" border="1">
          <tr>
          <td bgcolor="#99999 9">&nbsp;</td>
          <td bgcolor="#99999 9">&nbsp;</td>

          <td bgcolor="#99999 9">&nbsp;</td>
          <td bgcolor="#99999 9">&nbsp;</td>
          <td bgcolor="#99999 9">&nbsp;</td>
          </tr>
          <tr>
          <td bgcolor="#99999 9">&nbsp;</td>
          <td><input name="box1" type="text" value="" size="3" maxlength="2" tabindex="1" /></td>
          <td><input name="box2" type="text" value="" size="3" maxlength="2" tabindex="2"/></td>
          <td><input name="box3" type="text" value="" size="3" maxlength="2" tabindex="3" /></td>

          <td bgcolor="#CCFFF F"><input type="text" name="box4" size="3" maxlength="2" readonly></td>
          </tr>
          <tr>
          <td bgcolor="#99999 9">&nbsp;</td>
          <td><input name="5" type="text" value="" size="3" maxlength="2" tabindex="4"/></td>
          <td><input name="box6" type="text" value="" size="3" maxlength="2" tabindex="5"/></td>
          <td><input name="box7" type="text" value="" size="3" maxlength="2" tabindex="6"/></td>
          <td bgcolor="#CCFFF F"><input type="text" name="8" size="3" maxlength="2" readonly/></td>
          </tr>

          <tr>
          <td bgcolor="#99999 9">&nbsp;</td>
          <td><input name="box9" type="text" value="" size="3" maxlength="2" tabindex="7"/></td>
          <td><input name="box10" type="text" value="" size="3" maxlength="2" tabindex="8"/></td>
          <td><input name="box11" type="text" value="" size="3" maxlength="2" tabindex="9"/></td>
          <td bgcolor="#CCFFF F"><input type="text" name="box12" size="3" maxlength="2" readonly /></td>
          </tr>
          <tr>
          <td bgcolor="#CCFFF F"><input type="text" name="box13" size="3" maxlength="2" tabindex="1" readonly/></td>

          <td bgcolor="#CCFFF F"><input type="text" name="box14" size="3" maxlength="2" readonly/></td>
          <td bgcolor="#CCFFF F"><input type="text" name="box15" size="3" maxlength="2" readonly/></td>
          <td bgcolor="#CCFFF F"><input type="text" name="box16" size="3" maxlength="2" readonly /></td>
          <td bgcolor="#CCFFF F"><input type="text" name="box17" size="3" maxlength="2" readonly/></td>
          </tr>
          </table>
          <input type="button" value="check sum">

          </form>
          Last edited by birdboy272; May 29 '07, 09:22 PM. Reason: more data

          Comment

          • mrhoo
            Contributor
            • Jun 2006
            • 428

            #6
            <input name="box7" type="text" value="" size="3" maxlength="2" tabindex="6"/>
            <input type="button" value="check sum">
            Close all of your input tags or none of them-
            it looks like you don't know your own mind.

            Comment

            • iam_clint
              Recognized Expert Top Contributor
              • Jul 2006
              • 1207

              #7
              me? i would do something like this
              [CODE=javascript]
              <script>
              function checksum() {
              var v1 = 0;
              var v2 = 0;
              var v3 = 0;
              var all = ["box1", "box2", "box3", "box5", "box6", "box7", "box9", "box10", "box11"];
              for (i=0; i<all.length; i++) {
              for (b=0; b<all.length; b++) {
              if (i!=b && document.getEle mentsByName(all[b])[0].value == document.getEle mentsByName(all[i])[0].value) { alert("Two of your numbers are the same! can't continue!"); return false; }
              }
              }
              v1 = parseFloat(docu ment.getElement sByName("box1")[0].value);
              v2 = parseFloat(docu ment.getElement sByName("box2")[0].value);
              v3 = parseFloat(docu ment.getElement sByName("box3")[0].value);
              document.getEle mentsByName("bo x4")[0].value = Math.floor(v1+v 2+v3);
              var a1 = Math.floor(v1+v 2+v3);
              v1 = parseFloat(docu ment.getElement sByName("box5")[0].value);
              v2 = parseFloat(docu ment.getElement sByName("box6")[0].value);
              v3 = parseFloat(docu ment.getElement sByName("box7")[0].value);
              document.getEle mentsByName("bo x8")[0].value = Math.floor(v1+v 2+v3);
              var a2 = Math.floor(v1+v 2+v3);
              v1 = parseFloat(docu ment.getElement sByName("box9")[0].value);
              v2 = parseFloat(docu ment.getElement sByName("box10" )[0].value);
              v3 = parseFloat(docu ment.getElement sByName("box11" )[0].value);
              document.getEle mentsByName("bo x12")[0].value = Math.floor(v1+v 2+v3);
              var a3 = Math.floor(v1+v 2+v3);
              v1 = parseFloat(docu ment.getElement sByName("box3")[0].value);
              v2 = parseFloat(docu ment.getElement sByName("box6")[0].value);
              v3 = parseFloat(docu ment.getElement sByName("box9")[0].value);
              document.getEle mentsByName("bo x13")[0].value = Math.floor(v1+v 2+v3);
              var a4 = Math.floor(v1+v 2+v3);
              v1 = parseFloat(docu ment.getElement sByName("box1")[0].value);
              v2 = parseFloat(docu ment.getElement sByName("box5")[0].value);
              v3 = parseFloat(docu ment.getElement sByName("box9")[0].value);
              document.getEle mentsByName("bo x14")[0].value = Math.floor(v1+v 2+v3);
              var a5 = Math.floor(v1+v 2+v3);
              v1 = parseFloat(docu ment.getElement sByName("box2")[0].value);
              v2 = parseFloat(docu ment.getElement sByName("box6")[0].value);
              v3 = parseFloat(docu ment.getElement sByName("box10" )[0].value);
              document.getEle mentsByName("bo x15")[0].value = Math.floor(v1+v 2+v3);
              var a6 = Math.floor(v1+v 2+v3);
              v1 = parseFloat(docu ment.getElement sByName("box3")[0].value);
              v2 = parseFloat(docu ment.getElement sByName("box7")[0].value);
              v3 = parseFloat(docu ment.getElement sByName("box11" )[0].value);
              document.getEle mentsByName("bo x16")[0].value = Math.floor(v1+v 2+v3);
              var a7 = Math.floor(v1+v 2+v3);
              v1 = parseFloat(docu ment.getElement sByName("box1")[0].value);
              v2 = parseFloat(docu ment.getElement sByName("box6")[0].value);
              v3 = parseFloat(docu ment.getElement sByName("box11" )[0].value);
              document.getEle mentsByName("bo x17")[0].value = Math.floor(v1+v 2+v3);
              var a8 = Math.floor(v1+v 2+v3);
              if (a1==a2 && a1==a3 && a1==a4 && a1==a5 && a1==a6 && a1==a7 && a1==a8) { alert("you win!"); } else { alert("try again"); }
              }
              </script>

              <form name="zform">
              <table width="200" border="1">
              <tr>
              <td bgcolor="#99999 9">&nbsp;</td>
              <td bgcolor="#99999 9">&nbsp;</td>

              <td bgcolor="#99999 9">&nbsp;</td>
              <td bgcolor="#99999 9">&nbsp;</td>
              <td bgcolor="#99999 9">&nbsp;</td>
              </tr>
              <tr>
              <td bgcolor="#99999 9">&nbsp;</td>
              <td><input name="box1" type="text" value="" size="3" maxlength="2" tabindex="1" /></td>
              <td><input name="box2" type="text" value="" size="3" maxlength="2" tabindex="2"/></td>
              <td><input name="box3" type="text" value="" size="3" maxlength="2" tabindex="3" /></td>

              <td bgcolor="#CCFFF F"><input type="text" name="box4" size="3" maxlength="2" readonly></td>
              </tr>
              <tr>
              <td bgcolor="#99999 9">&nbsp;</td>
              <td><input name="box5" type="text" value="" size="3" maxlength="2" tabindex="4"/></td>
              <td><input name="box6" type="text" value="" size="3" maxlength="2" tabindex="5"/></td>
              <td><input name="box7" type="text" value="" size="3" maxlength="2" tabindex="6"/></td>
              <td bgcolor="#CCFFF F"><input type="text" name="box8" size="3" maxlength="2" readonly/></td>
              </tr>

              <tr>
              <td bgcolor="#99999 9">&nbsp;</td>
              <td><input name="box9" type="text" value="" size="3" maxlength="2" tabindex="7"/></td>
              <td><input name="box10" type="text" value="" size="3" maxlength="2" tabindex="8"/></td>
              <td><input name="box11" type="text" value="" size="3" maxlength="2" tabindex="9"/></td>
              <td bgcolor="#CCFFF F"><input type="text" name="box12" size="3" maxlength="2" readonly /></td>
              </tr>
              <tr>
              <td bgcolor="#CCFFF F"><input type="text" name="box13" size="3" maxlength="2" tabindex="1" readonly/></td>

              <td bgcolor="#CCFFF F"><input type="text" name="box14" size="3" maxlength="2" readonly/></td>
              <td bgcolor="#CCFFF F"><input type="text" name="box15" size="3" maxlength="2" readonly/></td>
              <td bgcolor="#CCFFF F"><input type="text" name="box16" size="3" maxlength="2" readonly /></td>
              <td bgcolor="#CCFFF F"><input type="text" name="box17" size="3" maxlength="2" readonly/></td>
              </tr>
              </table>
              <input type="button" value="check sum" onclick="checks um();">
              </form>
              [/CODE]

              Comment

              • acoder
                Recognized Expert MVP
                • Nov 2006
                • 16032

                #8
                Since this is basically the same problem, I've merged the threads.

                Comment

                • iam_clint
                  Recognized Expert Top Contributor
                  • Jul 2006
                  • 1207

                  #9
                  yay homework thread I didn't see the other post

                  Comment

                  • birdboy272
                    New Member
                    • May 2007
                    • 10

                    #10
                    if and else

                    I need a if and else that says congratulations to the person is they get 15 in all the output squares for the game magic square

                    this is my code so far:

                    <h3>
                    Try to make 15 in each of the green boxes without using numbers 1-9 more than once.
                    I will know if your cheating :-{
                    </h3>
                    <form name="zform">

                    <table width="200" border="1">
                    <tr>
                    <td bgcolor="#99999 9">&nbsp;</td>
                    <td bgcolor="#99999 9">&nbsp;</td>

                    <td bgcolor="#99999 9">&nbsp;</td>
                    <td bgcolor="#99999 9">&nbsp;</td>
                    <td bgcolor="#99999 9">&nbsp;</td>
                    </tr>
                    <tr>
                    <td bgcolor="#99999 9">&nbsp;</td>
                    <td><input name="box1" type="text" value="" size="3" maxlength="2" tabindex="1" /></td>
                    <td><input name="box2" type="text" value="" size="3" maxlength="2" tabindex="2"/></td>
                    <td><input name="box3" type="text" value="" size="3" maxlength="2" tabindex="3" /></td>

                    <td bgcolor="#CCFFF F"><input type="text" name="box4" size="3" maxlength="2" readonly></td>
                    </tr>
                    <tr>
                    <td bgcolor="#99999 9">&nbsp;</td>
                    <td><input name="box5" type="text" value="" size="3" maxlength="2" tabindex="4"/></td>
                    <td><input name="box6" type="text" value="" size="3" maxlength="2" tabindex="5"/></td>
                    <td><input name="box7" type="text" value="" size="3" maxlength="2" tabindex="6"/></td>
                    <td bgcolor="#CCFFF F"><input type="text" name="box8" size="3" maxlength="2" readonly/></td>
                    </tr>

                    <tr>
                    <td bgcolor="#99999 9">&nbsp;</td>
                    <td><input name="box9" type="text" value="" size="3" maxlength="2" tabindex="7"/></td>
                    <td><input name="box10" type="text" value="" size="3" maxlength="2" tabindex="8"/></td>
                    <td><input name="box11" type="text" value="" size="3" maxlength="2" tabindex="9"/></td>
                    <td bgcolor="#CCFFF F"><input type="text" name="box12" size="3" maxlength="2" readonly /></td>
                    </tr>
                    <tr>
                    <td bgcolor="#CCFFF F"><input type="text" name="box13" size="3" maxlength="2" tabindex="1" readonly/></td>

                    <td bgcolor="#CCFFF F"><input type="text" name="box14" size="3" maxlength="2" readonly/></td>
                    <td bgcolor="#CCFFF F"><input type="text" name="box15" size="3" maxlength="2" readonly/></td>
                    <td bgcolor="#CCFFF F"><input type="text" name="box16" size="3" maxlength="2" readonly /></td>
                    <td bgcolor="#CCFFF F"><input type="text" name="box17" size="3" maxlength="2" readonly/></td>
                    </tr>
                    </table>
                    <input type="button" value="check sum" onClick="checks um();">

                    </form>

                    <script>

                    function checksum(){
                    var sVal = zform.box4.valu e;
                    zform.box4.valu e = parseInt(zform. box1.value) + parseInt(zform. box2.value) + parseInt(zform. box3.value);
                    // line break
                    zform.box8.valu e = parseInt(zform. box5.value) + parseInt(zform. box6.value) + parseInt(zform. box7.value);
                    // line break
                    zform.box12.val ue = parseInt(zform. box9.value) + parseInt(zform. box10.value) + parseInt(zform. box11.value);
                    // line break
                    zform.box17.val ue = parseInt(zform. box1.value) + parseInt(zform. box6.value) + parseInt(zform. box11.value);
                    //line break
                    zform.box15.val ue = parseInt(zform. box2.value) + parseInt(zform. box6.value) + parseInt(zform. box10.value);
                    //line break
                    zform.box14.val ue = parseInt(zform. box1.value) + parseInt(zform. box5.value) + parseInt(zform. box9.value);
                    //line break
                    zform.box16.val ue = parseInt(zform. box3.value) + parseInt(zform. box7.value) + parseInt(zform. box11.value);
                    //line break
                    zform.box13.val ue = parseInt(zform. box3.value) + parseInt(zform. box6.value) + parseInt(zform. box9.value);
                    }

                    </script>

                    Comment

                    • birdboy272
                      New Member
                      • May 2007
                      • 10

                      #11
                      THank you for all the help

                      this is the code I used I need a working if and else now

                      need a if and else that says congratulations to the person if they get 15 in all the output squares for the game magic square

                      this is my code so far:

                      <h3>
                      Try to make 15 in each of the green boxes without using numbers 1-9 more than once.
                      I will know if your cheating :-{
                      </h3>
                      <form name="zform">

                      <table width="200" border="1">
                      <tr>
                      <td bgcolor="#99999 9">&nbsp;</td>
                      <td bgcolor="#99999 9">&nbsp;</td>

                      <td bgcolor="#99999 9">&nbsp;</td>
                      <td bgcolor="#99999 9">&nbsp;</td>
                      <td bgcolor="#99999 9">&nbsp;</td>
                      </tr>
                      <tr>
                      <td bgcolor="#99999 9">&nbsp;</td>
                      <td><input name="box1" type="text" value="" size="3" maxlength="2" tabindex="1" /></td>
                      <td><input name="box2" type="text" value="" size="3" maxlength="2" tabindex="2"/></td>
                      <td><input name="box3" type="text" value="" size="3" maxlength="2" tabindex="3" /></td>

                      <td bgcolor="#CCFFF F"><input type="text" name="box4" size="3" maxlength="2" readonly></td>
                      </tr>
                      <tr>
                      <td bgcolor="#99999 9">&nbsp;</td>
                      <td><input name="box5" type="text" value="" size="3" maxlength="2" tabindex="4"/></td>
                      <td><input name="box6" type="text" value="" size="3" maxlength="2" tabindex="5"/></td>
                      <td><input name="box7" type="text" value="" size="3" maxlength="2" tabindex="6"/></td>
                      <td bgcolor="#CCFFF F"><input type="text" name="box8" size="3" maxlength="2" readonly/></td>
                      </tr>

                      <tr>
                      <td bgcolor="#99999 9">&nbsp;</td>
                      <td><input name="box9" type="text" value="" size="3" maxlength="2" tabindex="7"/></td>
                      <td><input name="box10" type="text" value="" size="3" maxlength="2" tabindex="8"/></td>
                      <td><input name="box11" type="text" value="" size="3" maxlength="2" tabindex="9"/></td>
                      <td bgcolor="#CCFFF F"><input type="text" name="box12" size="3" maxlength="2" readonly /></td>
                      </tr>
                      <tr>
                      <td bgcolor="#CCFFF F"><input type="text" name="box13" size="3" maxlength="2" tabindex="1" readonly/></td>

                      <td bgcolor="#CCFFF F"><input type="text" name="box14" size="3" maxlength="2" readonly/></td>
                      <td bgcolor="#CCFFF F"><input type="text" name="box15" size="3" maxlength="2" readonly/></td>
                      <td bgcolor="#CCFFF F"><input type="text" name="box16" size="3" maxlength="2" readonly /></td>
                      <td bgcolor="#CCFFF F"><input type="text" name="box17" size="3" maxlength="2" readonly/></td>
                      </tr>
                      </table>
                      <input type="button" value="check sum" onClick="checks um();">

                      </form>

                      <script>

                      function checksum(){
                      var sVal = zform.box4.valu e;
                      zform.box4.valu e = parseInt(zform. box1.value) + parseInt(zform. box2.value) + parseInt(zform. box3.value);
                      // line break
                      zform.box8.valu e = parseInt(zform. box5.value) + parseInt(zform. box6.value) + parseInt(zform. box7.value);
                      // line break
                      zform.box12.val ue = parseInt(zform. box9.value) + parseInt(zform. box10.value) + parseInt(zform. box11.value);
                      // line break
                      zform.box17.val ue = parseInt(zform. box1.value) + parseInt(zform. box6.value) + parseInt(zform. box11.value);
                      //line break
                      zform.box15.val ue = parseInt(zform. box2.value) + parseInt(zform. box6.value) + parseInt(zform. box10.value);
                      //line break
                      zform.box14.val ue = parseInt(zform. box1.value) + parseInt(zform. box5.value) + parseInt(zform. box9.value);
                      //line break
                      zform.box16.val ue = parseInt(zform. box3.value) + parseInt(zform. box7.value) + parseInt(zform. box11.value);
                      //line break
                      zform.box13.val ue = parseInt(zform. box3.value) + parseInt(zform. box6.value) + parseInt(zform. box9.value);
                      }

                      </script>

                      Comment

                      • r035198x
                        MVP
                        • Sep 2006
                        • 13225

                        #12
                        Originally posted by birdboy272
                        I need a if and else that says congratulations to the person is they get 15 in all the output squares for the game magic square

                        this is my code so far:

                        <h3>
                        Try to make 15 in each of the green boxes without using numbers 1-9 more than once.
                        I will know if your cheating :-{
                        </h3>
                        <form name="zform">

                        <table width="200" border="1">
                        <tr>
                        <td bgcolor="#99999 9">&nbsp;</td>
                        <td bgcolor="#99999 9">&nbsp;</td>

                        <td bgcolor="#99999 9">&nbsp;</td>
                        <td bgcolor="#99999 9">&nbsp;</td>
                        <td bgcolor="#99999 9">&nbsp;</td>
                        </tr>
                        <tr>
                        <td bgcolor="#99999 9">&nbsp;</td>
                        <td><input name="box1" type="text" value="" size="3" maxlength="2" tabindex="1" /></td>
                        <td><input name="box2" type="text" value="" size="3" maxlength="2" tabindex="2"/></td>
                        <td><input name="box3" type="text" value="" size="3" maxlength="2" tabindex="3" /></td>

                        <td bgcolor="#CCFFF F"><input type="text" name="box4" size="3" maxlength="2" readonly></td>
                        </tr>
                        <tr>
                        <td bgcolor="#99999 9">&nbsp;</td>
                        <td><input name="box5" type="text" value="" size="3" maxlength="2" tabindex="4"/></td>
                        <td><input name="box6" type="text" value="" size="3" maxlength="2" tabindex="5"/></td>
                        <td><input name="box7" type="text" value="" size="3" maxlength="2" tabindex="6"/></td>
                        <td bgcolor="#CCFFF F"><input type="text" name="box8" size="3" maxlength="2" readonly/></td>
                        </tr>

                        <tr>
                        <td bgcolor="#99999 9">&nbsp;</td>
                        <td><input name="box9" type="text" value="" size="3" maxlength="2" tabindex="7"/></td>
                        <td><input name="box10" type="text" value="" size="3" maxlength="2" tabindex="8"/></td>
                        <td><input name="box11" type="text" value="" size="3" maxlength="2" tabindex="9"/></td>
                        <td bgcolor="#CCFFF F"><input type="text" name="box12" size="3" maxlength="2" readonly /></td>
                        </tr>
                        <tr>
                        <td bgcolor="#CCFFF F"><input type="text" name="box13" size="3" maxlength="2" tabindex="1" readonly/></td>

                        <td bgcolor="#CCFFF F"><input type="text" name="box14" size="3" maxlength="2" readonly/></td>
                        <td bgcolor="#CCFFF F"><input type="text" name="box15" size="3" maxlength="2" readonly/></td>
                        <td bgcolor="#CCFFF F"><input type="text" name="box16" size="3" maxlength="2" readonly /></td>
                        <td bgcolor="#CCFFF F"><input type="text" name="box17" size="3" maxlength="2" readonly/></td>
                        </tr>
                        </table>
                        <input type="button" value="check sum" onClick="checks um();">

                        </form>

                        <script>

                        function checksum(){
                        var sVal = zform.box4.valu e;
                        zform.box4.valu e = parseInt(zform. box1.value) + parseInt(zform. box2.value) + parseInt(zform. box3.value);
                        // line break
                        zform.box8.valu e = parseInt(zform. box5.value) + parseInt(zform. box6.value) + parseInt(zform. box7.value);
                        // line break
                        zform.box12.val ue = parseInt(zform. box9.value) + parseInt(zform. box10.value) + parseInt(zform. box11.value);
                        // line break
                        zform.box17.val ue = parseInt(zform. box1.value) + parseInt(zform. box6.value) + parseInt(zform. box11.value);
                        //line break
                        zform.box15.val ue = parseInt(zform. box2.value) + parseInt(zform. box6.value) + parseInt(zform. box10.value);
                        //line break
                        zform.box14.val ue = parseInt(zform. box1.value) + parseInt(zform. box5.value) + parseInt(zform. box9.value);
                        //line break
                        zform.box16.val ue = parseInt(zform. box3.value) + parseInt(zform. box7.value) + parseInt(zform. box11.value);
                        //line break
                        zform.box13.val ue = parseInt(zform. box3.value) + parseInt(zform. box6.value) + parseInt(zform. box9.value);
                        }

                        </script>
                        1.) Please use code tags next time when posting code.
                        2.) Write the function and if you get errors you can post and we'll be able to help. Syntax for if is
                        [CODE=javascript] if(sum == 15) {
                        alert("Congratu lations");
                        }
                        [/CODE]

                        Comment

                        • acoder
                          Recognized Expert MVP
                          • Nov 2006
                          • 16032

                          #13
                          Threads merged. Please keep this in one thread.

                          Comment

                          • iam_clint
                            Recognized Expert Top Contributor
                            • Jul 2006
                            • 1207

                            #14
                            Shhhh.... you can tell how much of the thread they really read...

                            Comment

                            Working...