Advertisements

In article
<>,
BillyZ <> wrote:
> I am implementing a conditional menu. The script below is evaluating
> to see if I am on either of two specific pages. I have done it two
> different way's and both are below.
> Thanks in advance.
>
> #1 This returns false all the time.
>
> if (pageName == ('nacPartnerPage') || ('networkAccessPage')) {

Tim Streater wrote:
> BillyZ <> wrote:
>> I am implementing a conditional menu. The script below is evaluating
>> to see if I am on either of two specific pages. I have done it two
>> different way's and both are below.
>> Thanks in advance.
>>
>> #1 This returns false all the time.
>>
>> if (pageName == ('nacPartnerPage') || ('networkAccessPage')) {
>
> This is not how you do an "or". You need to write:
>
> if ((pageName=='nacPartnerPage') || (pageName=='networkAccessPage')) {

Another, less compatible possibility[1] is

if (pageName in {nacPartnerPage: 1, networkAccessPage: 1}) {

(provided one has not augmented Object.prototype).

But the `if' statement really is superfluous here:

nacSecondary = (one_of_the_suggested_boolean_expressions);

PointedEars
___________
[1] <http://PointedEars.de/es-matrix#i>
--
Prototype.js was written by people who don't know javascript for people
who don't know javascript. People who don't know javascript are not
the best source of advice on designing systems that use javascript.
-- Richard Cornford, cljs, <f806at$ail$1$>

Share This Page

Welcome to The Coding Forums!

Welcome to the Coding Forums, the place to chat about anything related to programming and coding languages.

Please join our friendly community by clicking the button below - it only takes a few seconds and is totally free. You'll be able to ask questions about coding or chat with the community and help others.
Sign up now!