Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > var in array if not empty

Reply
Thread Tools

var in array if not empty

 
 
rlo
Guest
Posts: n/a
 
      11-03-2004
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


 
Reply With Quote
 
 
 
 
Michael Winter
Guest
Posts: n/a
 
      11-04-2004
On Wed, 3 Nov 2004 23:45:16 +0100, rlo <(E-Mail Removed)> 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.
 
Reply With Quote
 
 
 
 
Thomas 'PointedEars' Lahn
Guest
Posts: n/a
 
      12-12-2004
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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
what is it for an array ? int f(int VAR) { int tab[VAR]; .. } Alain Spineux C Programming 6 05-17-2011 01:03 AM
Re: capitalize() NOT the same as var[0].upper _ var[1:] James Mills Python 2 06-10-2010 07:34 AM
Difference between Session["var"] and Session("var") thomson ASP .Net 10 06-20-2005 01:02 PM
Difference between Session["var"] and Session("var") thomson ASP .Net 0 06-20-2005 10:54 AM
Threads.. Session var lost, App var ok Alvin Bruney ASP .Net 1 12-02-2003 01:56 AM



Advertisments