var in array if not empty

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • rlo

    #1

    var in array if not empty

    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


  • Michael Winter

    #2
    Re: var in array if not empty

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

    [snip]
    [color=blue]
    > How can I slove this problem?[/color]

    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.

    Comment

    • Thomas 'PointedEars' Lahn

      #3
      Re: var in array if not empty

      rlo wrote:
      [color=blue]
      > use the next script:
      >
      > var answers0 = new Array(
      > (answer11),
      > (answer12),
      > (answer13),
      > (answer14) );[/color]

      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 '.
      [color=blue]
      > question[0]= new geefVraag( 0,
      > 'question1', oke1-1, answers0);[/color]

      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.
      [color=blue]
      > feedback[0]= new Array(
      > 'feedb1');[/color]

      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.
      [color=blue]
      > but antw11, antw12, antw13 and antw14 may only be used in the array
      > if antw11<>"" etc.[/color]

      Sorry, I do not understand this.
      [color=blue]
      > How can I slove this problem?[/color]

      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

      Comment

      Working...