Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Oct 2005
    Thanked 0 Times in 0 Posts

    Carriage Return FOR Javascript Code

    I'm trying to load an ASP recordset into a javascript array via an ASP array. The way I've been attempting to do it is by having ASP "Response.Write()" the javascript code that builds the javascript array. It ALMOST works

    The problem I'm having is that the ASP writes the different javascript lines as one long line (ie. no carriage returns). Therefore, the javascript lines are not recognized. When I take the source code and manually separate the lines produced...then when I run the modified source, it works fine.

    I'm just wondering if javascript has a command to either goto the next line, or to signal the end of the command/line. Below is my "source" code (ie. the code the ASP produces)...

    <p>PROFILE_CD value is: 3</p>
    <p>NUM_REC value is: 6</p>
    <script type='text/javascript'>//Builds the Javascript Array...//***************************************************var js_num_rec = 6var aTRANSfunc = new Array()aTRANSfunc[0] = new Array(2)aTRANSfunc[0][0] = 'CPDB54'aTRANSfunc[0][1] = '00'aTRANSfunc[1] = new Array(2)aTRANSfunc[1][0] = 'CPDB54'aTRANSfunc[1][1] = '01'aTRANSfunc[2] = new Array(2)aTRANSfunc[2][0] = 'CPDB54'aTRANSfunc[2][1] = '04'aTRANSfunc[3] = new Array(2)aTRANSfunc[3][0] = 'CPDB54'aTRANSfunc[3][1] = '05'aTRANSfunc[4] = new Array(2)aTRANSfunc[4][0] = 'CPDB60'aTRANSfunc[4][1] = '00'aTRANSfunc[5] = new Array(2)aTRANSfunc[5][0] = 'CPDB60'aTRANSfunc[5][1] = '01'</script>

    <script type="text/javascript">
    document.write("<p>The js_num_rec value is: " + js_num_rec + "</p>")
    //Displays the Javascript Array...
    document.write("<table border='1'>")
    for (i=0;i<aTRANSfunc.length;i++)
    document.write("<tr><td width='100'>")
    document.write("</td><td width='100'>")
    document.write("</td><td width='100'>")


    Any assistance is greatly appreciated. Thanks.


  • #2
    Regular Coder
    Join Date
    Aug 2005
    Toronto, ON, Canada
    Thanked 0 Times in 0 Posts
    This is not a javascript problem, but the problem with ASP code, in particular how JS portion has been generated.

    you should see something like:

    var js_num_rec = 6;
    var aTRANS;
    func = new Array();
    aTRANSfunc[0] = new Array(2);

    instead of:
    var js_num_rec = 6var aTRANSfunc = new Array()aTRANSfunc[0] = new Array(2)

    it is possible VB mixed semicolons
    Last edited by rm-f; 10-13-2005 at 07:48 PM.
    rm -f /


    Posting Permissions

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