Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Java Script Problem

Options
  • 26-07-2004 4:49pm
    #1
    Closed Accounts Posts: 537 ✭✭✭


    ListBox1.RemoveAll();
    var i ;
    Var Max = ActiveDocument . Sections ["Results"].Columns.Count ;
    For ( i=1 ; i <= Max ; i++)
    {
    ListBox1.add(ActiveDocument.Sections["Results"]columns.Name);
    }

    Syntax error in line 3 somewhere
    Can anyone see it


Comments

  • Registered Users Posts: 68,317 ✭✭✭✭seamus


    Sections["Results"]
    may need to be
    Sections

    Also, last line, should
    Sections["Results"]columns
    not be
    Sections.columns

    If that's a copy and paste from your code, then tidy up your whitespace before debugging :)


  • Closed Accounts Posts: 537 ✭✭✭JohnnyBravo


    I dont know what the story is with it i took it straight out of a book


    ListBox1.RemoveAll();
    var i;
    Var Max=ActiveDocument .Sections ["Results"].Columns.Count ;
    For ( i=1 ; i <= Max ; i++)
    {
    ListBox1.add(ActiveDocument.Sections["Results"]columns.Name);
    }

    Even though i changed it to single quotes the same error persists
    Missing ; before statement in line 3


  • Moderators, Politics Moderators Posts: 39,765 Mod ✭✭✭✭Seth Brundle


    is your listbox named Listbox1?
    Is there a space between on either side of the '.' on line 3 --> ActiveDocument . Sections


  • Registered Users Posts: 68,317 ✭✭✭✭seamus


    Originally posted by kbannon
    is your listbox named Listbox1?
    Is there a space between on either side of the '.' on line 3 --> ActiveDocument . Sections
    Yeah, definitely those spaces causing the problem if that's a cut-and-paste from your code.


  • Closed Accounts Posts: 537 ✭✭✭JohnnyBravo


    ListBox1.RemoveAll();
    var i;
    var Max=ActiveDocument.Sections["Results"].Columns.Count;
    For (i=1;i<=Max;i++)
    {
    ListBox1.add(ActiveDocument.Sections["Results"]columns.Name);
    }


    It was a capital V in var Max that was the problem

    However now there is a missing ")" after argument list in line four


  • Advertisement
  • Registered Users Posts: 68,317 ✭✭✭✭seamus


    ActiveDocument.Sections["Results"]dotcolumns.Name


  • Closed Accounts Posts: 537 ✭✭✭JohnnyBravo


    If i take out the dot i get the original error
    If i leave in the dot i get the latter error


  • Registered Users Posts: 68,317 ✭✭✭✭seamus


    Post up or attach the full page there.


  • Closed Accounts Posts: 537 ✭✭✭JohnnyBravo


    I cant its not a web page it is a reporting tool called BRIO


    I am simply trying to populate a combo box with values and that is all the code that is there


  • Moderators, Politics Moderators Posts: 39,765 Mod ✭✭✭✭Seth Brundle


    1. in the code there should be no spaces on either side of the dots
    2. change For to for (lower case)


  • Advertisement
  • Registered Users Posts: 3,137 ✭✭✭oneweb


    I'm open to correction on this but aren't variables supposed to start with lowercase and functions uppercase?

    listBox1.RemoveAll();
    var i;
    var max=activeDocument.sections["Results"].columns.count;
    for (i=1;i<=Max;i++)
    {
    listBox1.add(activeDocument.sections["Results"].columns.name);
    }

    ...also is this just a 'Programming JavaScript for IE' thing or will it work cross-browser? The capitalisation bangs of VBScript.

    It is what it's.



  • Closed Accounts Posts: 537 ✭✭✭JohnnyBravo


    Just a quick Query


    "].columns.name);


    Is this .name thing supposed to be the name of the column you should be querying


Advertisement