SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Addict
    Join Date
    Sep 2008
    Location
    Rudgwick, UK
    Posts
    378
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Error - checkboxes, but can't see why :/

    Hi,

    Can anyone spot why I get an error with this code:


    Code:
    <script>
    function check_the_number_boxes_selected() {
    	var checkbox_choices = 0;
    	for (counter = 0; counter < compare.File_IDs_To_Compare.length; counter++) {
    
    		if (compare.File_IDs_To_Compare[counter].checked) { 
    		  checkbox_choices = checkbox_choices + 1; }
    		}
        }
    
    /*    alert("foo");*/
    }
    </script>
    The error doesn't give anything away:
    Code:
    Error: syntax error
    Source File: http://domain.com/tracker.cgi
    Line: 56
    Source Code:
    }
    ..line 56 is the closing }

    I've been going over it for the last 30 mins - so I'm obviously missing something (probably simple!)

    BTW, this is the code that generates the checkbox list:

    Code:
    <form method="POST" action="gforum.cgi" name="compare">
    
     
    		<ul>
    		<%loop recent_loop%>
    		    <li> <input type="checkbox" name="File_IDs_To_Compare" value="<%ID%>" onclick="check_the_number_boxes_selected();" /> <a href="gforum.cgi?do=tracker;action=view;ID=<%ID%>"><%FilePath%></a> - (<%nice_time%>)</li>
    		<%endloop%>
    		</ul>
    
        <input type="submit" value="Show Changes" name="B1"> <input type="reset" value="Reset" name="B2">
        
        <input type="hidden" name="action" value="add_change" />
        <input type="hidden" name="do" value="tracker" />
    
    </form>
    (the <%loop%> section basically just goes through an array, and outputs different options, all with the same name="")

    TIA

    Andy

  2. #2
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,290
    Mentioned
    198 Post(s)
    Tagged
    3 Thread(s)
    You have one more closing curly brace than you do opening curly braces.

  3. #3
    SitePoint Addict
    Join Date
    Sep 2008
    Location
    Rudgwick, UK
    Posts
    378
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    haha knew it had to be something simple.

    Thanks


Bookmarks

Posting Permissions

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