SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Addict lostatsea's Avatar
    Join Date
    Oct 2005
    0 Post(s)
    0 Thread(s)

    Missing ')' Javascript code error 0

    hello everyone

    I have a bit of an issue. At work I have IE6 on a WIN XP machine and this script works just fine.

    When I try to use it on my IE7/Vista machine it does not work and I get a javascript error saying there is a missing ')' with a Code 0 error.

    Can someone please tell me where I have a missing ')' because I am lost.


    <script language="JavaScript1.1" type="text/javascript">
    /*create the initial array to hold the different records.*/

    var aryLocation = new Array();

    /*Now to bring in the data. This is a combination
    of ColdFusion and JavaScript
    We set a variable for our loop to insert the data.
    The loop starts at zero because
    JavaScript arrays start at zero.*/

    <cfset Variables.JSLoop = 0>

    /*The next lines create an array of 3 items in the outer array.
    It could hold more than three items if we needed more than 3 selects
    related. I have also included the NAMES that belong to the HUC IDs.*/

    <cfloop query="getHUCS">
    aryLocation[#Variables.JSLoop#] = new Array("#getHUCS.STATE_ABB#", "#getHUCS.HUC8_ID#" + ' ' + "#getHUCS.HUC8_NAME#", "#getHUCS.HUC12_ID#" + ' ' + "#getHUCS.HUC12_NAME#" + '-' + "#getHUCS.HUC_STATE_ID#");
    <cfset Variables.JSLoop = Variables.JSLoop + 1>

    /*This function takes four arguments.
    They will be the STATE_ABB (the STATE_ABB select box), the HUC8_ID (the HUC8_ID select
    box), the HUC12_ID (the HUC12_ID select box) and thisSel (the select box that actually
    called for the change to occur).

    local variables*/

    function tsrUpdSelect(frstSel, scndSel, thrdSel, thisSel)
    var i; var chkCty = "";

    /*see if we just changed the first select box (STATE_ABB)*/

    if( ==
    /*set the length of the other selects to zero to empty them*/
    scndSel.options.length = 0;
    thrdSel.options.length = 0;

    /*set the first option for each (being messages to do a select).*/

    scndSel.options[scndSel.length] = new Option("Choose a HUC8", "");
    thrdSel.options[thrdSel.length] = new Option("Choose HUC12s", "");

    /*Now loop through and set the second option list (HUC8_ID).
    If a STATE_ABB was chosen. There is also code to prevent duplicate
    HUC8_IDs. This could happen if a HUC8_ID had multiple HUC12_IDs.*/

    if(thisSel.options[thisSel.selectedIndex].value != "") {
    for (i = 0; i < aryLocation.length; i++) {
    if(aryLocation[i][0] == thisSel.options[thisSel.selectedIndex].value && chkCty.lastIndexOf(aryLocation[i][1]) == -1)
    scndSel.options[scndSel.length] = new Option(aryLocation[i][1], aryLocation[i][1]); chkCty = chkCty + "," + aryLocation[i][1];

    /*see if we just changed the second select box(HUC8_ID).*/

    if( == {

    /*set the length of the third select to zero.*/
    thrdSel.options.length = 0;

    /*set the first option.*/

    thrdSel.options[thrdSel.length] = new Option("Choose HUC12s", "");

    /*set the rest of the values if a HUC8_ID was chosen.*/

    for(i=0; i < aryLocation.length; i++)
    if(aryLocation[i][0] == frstSel.options[frstSel.selectedIndex].value && aryLocation[i][1] ==
    thrdSel.options[thrdSel.length] = new Option(aryLocation[i][2], aryLocation[i][2])


    In advance, thanks to anyone who can spot this missing ')'

  2. #2
    SitePoint Wizard gold trophysilver trophybronze trophy dc dalton's Avatar
    Join Date
    Nov 2004
    Right behind you, watching, always watching.
    0 Post(s)
    0 Thread(s)
    Instead of showing us the ColdFusion code show us the output (the browser's source code)

    Trying to debug JavaScript inside another language is a nightmare!


Posting Permissions

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