Results 1 to 6 of 6

Thread: syntax error ?

  1. #1

    Thread Starter
    Evil Genius alex_read's Avatar
    Join Date
    May 2000
    Location
    Espoo, Finland
    Posts
    5,538

    syntax error ?

    Code:
    if (document.forms.item("hidGamChosen") != "") _ 
    AND (document.forms.item("hidGamChosen") != null) {
    Can anyone tell me if I've written that one right?
    (I haven't got the _ in the actual code), Thanks.
    Last edited by alex_read; Nov 29th, 2001 at 10:35 AM.

    Please rate this post if it was useful for you!
    Please try to search before creating a new post,
    Please format code using [ code ][ /code ], and
    Post sample code, error details & problem details

  2. #2
    Frenzied Member
    Join Date
    Feb 2001
    Posts
    1,140
    First, familiarize yourself with the DOM specs from the W3C.

    Second, do you have a form named "forms"?
    Travis, Kung Foo Journeyman
    As always, RTFM.

    WWW Standards: HTML 4.01, CSS Level 2, ECMA 262 Bindings to DOM Level 1, JavaScript 1.3 Guide and Reference
    Perl: Learn Perl, Llama, Camel, Cookbook, Perl Monks, Perl Mongers, O'Reilly's Perl.com, ActiveState, CPAN, TPJ, and use Perl;
    YBMS, but Mozilla doesn't.

  3. #3
    Fanatic Member Wynd's Avatar
    Join Date
    Dec 2000
    Location
    In a bar frequented by colossal death robots
    Posts
    772
    Instead of "AND", use "&&".
    Alcohol & calculus don't mix.
    Never drink & derive.

  4. #4

    Thread Starter
    Evil Genius alex_read's Avatar
    Join Date
    May 2000
    Location
    Espoo, Finland
    Posts
    5,538
    no, but the forms collection seems to work as well as if I name the form, I'll remember the && one.

    Thanks for the suggestions

    Please rate this post if it was useful for you!
    Please try to search before creating a new post,
    Please format code using [ code ][ /code ], and
    Post sample code, error details & problem details

  5. #5
    PowerPoster
    Join Date
    Nov 2001
    Location
    Trying to reach and stay in the cloud
    Posts
    2,089

    Arrow hi

    Why not simply use it this way :

    Code:
    if (document.formname.hidGamChosen != "") && (document.formname.hidGamChosen != null) {

  6. #6
    Frenzied Member
    Join Date
    Feb 2001
    Posts
    1,140
    Yeah, Jonny, that is what I was driving at. I don't think the item collection is part of the standard.

    Wynd found the error though. That's what I get for using entirely too many languages in one day. Another reason to stop using VB: Perl, JavaScript, C++, and Java all have similar syntax.
    Travis, Kung Foo Journeyman
    As always, RTFM.

    WWW Standards: HTML 4.01, CSS Level 2, ECMA 262 Bindings to DOM Level 1, JavaScript 1.3 Guide and Reference
    Perl: Learn Perl, Llama, Camel, Cookbook, Perl Monks, Perl Mongers, O'Reilly's Perl.com, ActiveState, CPAN, TPJ, and use Perl;
    YBMS, but Mozilla doesn't.

Posting Permissions

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



Click Here to Expand Forum to Full Width