[thelist] Frustrated - why does this code produce error at load?

Brian Delaney brian.delaney at mccmh.net
Tue Apr 5 13:00:05 CDT 2005


I get the error:

expected ' ;'  - when the page loads, the debugger puts it at line:
var agencynamearray() = new Array;

When a user types an agency code in I use 
onchange="javascript:getAgencyName(frmIncident);" to call this so the 
next field can be auto populated with the agency name.

This code is at the bottom of the page in the javscript section;

function getAgencyName(frmIncident)
        {
        var agencynamearray() = new Array;
        var agencycodearray() = new Array;
        <%
        Call OpenORRDBConn()
        Set rsAgency = Server.CreateObject("ADODB.Recordset")
        strSQL = "SELECT ID, AgencyNo, AgencyName from Agencies order by 
AgencyNo"
        rsAgency.Open strSQL, ORRDBConn
       
        intCount = 0
        do until rsAgency.eof
            strName = rsAgency("agencyname")
            strCode = rsAgency("agencyno")
            response.write "agencynamearray[" & intCount & "] = " & 
strName & ";" & chr(13) 
            response.write "agencycodearray[" & intCount + 1 & "] = " & 
strCode & ";" & chr(13)
            intCount = intCount + 1
            rsAgency.movenext
        loop
        %>
               
            for (i=0; i<<%=intCount + 1%>; i++)
                {
                if (frmIncident.txtAgencyCode.value == agencycodearray[i])
                    {       
                    frmIncident.txtAgencyName.Value = agencynamearray[i];
                    } //end if
                } //end for
                   
        } //end function

thanks

B

*
*
*
This message, including any attachments, is intended solely for the use of the named recipient(s) and may contain confidential and/or priveleged information.  Any unauthorized review, use, disclosure or distribution of this communication(s) is expressly prohibited.  If you are not the intended recipient, please contact the sender by reply e-mail and destroy any and all copies of the original message.


More information about the thelist mailing list