PDA

Click to See Complete Forum and Search --> : syntax error ?


alex_read
Nov 29th, 2001, 09:09 AM
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.

CiberTHuG
Nov 29th, 2001, 12:11 PM
First, familiarize yourself with the DOM specs from the W3C.

Second, do you have a form named "forms"?

Wynd
Nov 29th, 2001, 05:28 PM
Instead of "AND", use "&&".

alex_read
Nov 30th, 2001, 02:34 AM
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 :)

veryjonny
Nov 30th, 2001, 04:05 AM
Why not simply use it this way :


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

CiberTHuG
Nov 30th, 2001, 08:30 AM
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.