var in array if not empty

Discussion in 'Javascript' started by rlo, Nov 3, 2004.

  1. rlo

    rlo Guest

    use the next script:

    var answers0 = new Array(
    (answer11),
    (answer12),
    (answer13),
    (answer14) );
    question[0]= new geefVraag( 0,
    'question1', oke1-1, answers0);
    feedback[0]= new Array(
    'feedb1');

    but antw11, antw12, antw13 and antw14 may only be used in the array if
    antw11<>"" etc.

    How can I slove this problem?
    Ronald
    rlo, Nov 3, 2004
    #1
    1. Advertising

  2. On Wed, 3 Nov 2004 23:45:16 +0100, rlo <> wrote:

    [snip]

    > How can I slove this problem?


    Readers of this group are Dutch, and some can read it. It might be worth
    asking the question again in your natural language and give a more
    thorough explanation. Whilst I understand what you stated, I don't know
    what you were asking.

    There's nothing wrong with posting in a language other than English[1],
    just realise that you might reduce the potential number of replies.

    Good luck,
    Mike


    [1] Though a translation, if possible, in the same post might be nice.

    --
    Michael Winter
    Replace ".invalid" with ".uk" to reply by e-mail.
    Michael Winter, Nov 4, 2004
    #2
    1. Advertising

  3. rlo wrote:

    > use the next script:
    >
    > var answers0 = new Array(
    > (answer11),
    > (answer12),
    > (answer13),
    > (answer14) );


    You may (and should) omit the parantheses around the values "answer11" aso.
    unless the latter are not considered to be variable references but string
    values; in that case change the parentheses into matching pairs of " or '.

    > question[0]= new geefVraag( 0,
    > 'question1', oke1-1, answers0);


    Unless `question' has not been defined to refer to an object (say, an
    Object or Array object) earlier, this syntax causes a script error as
    `question' cannot be resolved and neither can `question[0]'. This
    aside, the declaration of the geefVraag() constructor is missing from
    your source code, as well is the declaration of `oke1'; maybe there
    is a bug, too.

    > feedback[0]= new Array(
    > 'feedb1');


    The same here. You should declare (with the `var' keyword) and must
    define variables before you can successfully access the objects they
    should refer to or their properties.

    > but antw11, antw12, antw13 and antw14 may only be used in the array
    > if antw11<>"" etc.


    Sorry, I do not understand this.

    > How can I slove this problem?


    I suggest you first read on the basics of J(ava)Script programming,
    following the links in the FAQ.


    HTH

    PointedEars
    --
    Every knee shall bend, every mouth open, when I unzip
    Thomas 'PointedEars' Lahn, Dec 12, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Alvin Bruney

    Threads.. Session var lost, App var ok

    Alvin Bruney, Dec 2, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    357
    rooster575
    Dec 2, 2003
  2. thomson
    Replies:
    10
    Views:
    2,490
    Eliyahu Goldin
    Jun 20, 2005
  3. thomson
    Replies:
    0
    Views:
    377
    thomson
    Jun 20, 2005
  4. James Mills
    Replies:
    2
    Views:
    357
    geremy condra
    Jun 10, 2010
  5. Alain Spineux
    Replies:
    6
    Views:
    628
    Eric Sosman
    May 17, 2011
Loading...

Share This Page