JavaScript Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsWeb DesignJavaScript Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old December 4th, 2012, 12:40 PM
MCtechsupport MCtechsupport is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2012
Posts: 1 MCtechsupport User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 14 m
Reputation Power: 0
Other - Need Help Formating If/Or Statement

I am in desperate need of help. I have never done Javascript until about 2 weeks ago. I was able to fix a code to get the top bar of my page to open some links in a new window but I need for multiple to stay in the browser but so far this code only allows for one to do that. I am perplexed as to how I should write the If/Or code for this:

Code:
<ul id="toptoolbarlinklist"><{foreach key=key item=_item from=$_widgetContainer}><{if $_item[displayinnavbar] == '1'}><li<{if $_item[isactive] == true}> class="current"<{/if}>>
<{if $_item[defaulttitle] != 'Knowledgebase'}>
<{else if $_item[defaulttitle] == 'Learning Portal Login'}>
<{else if $_item[defaulttitle] == 'Update Contact Information'}>
<{else if $_item[defaulttitle] == 'Contact Us'}>
<a class="toptoolbarlink" style="<{if $_item[defaultsmallicon] != ''}>background-image: url(<{$_item[defaultsmallicon]}>);<{/if}>" href="<{$_item[widgetlink]}>"><{$_item[defaulttitle]}></a>
<{/if}>
<{if $_item[defaulttitle] != 'Knowledgebase'}>
<a class="toptoolbarlink" style="<{if $_item[defaultsmallicon] != ''}>background-image: url(<{$_item[defaultsmallicon]}>);<{/if}>" href="<{$_item[widgetlink]}>" target="_blank" ><{$_item[defaulttitle]}></a>

</li><{/if}><{/foreach}></ul>


For
Code:
<{if $_item[defaulttitle] != 'Knowledgebase'}>
I need for two links to not open in a new window. So in addition to "Knowledgebase" I also need "Home" to stay within the browser.

I have tried to change 2 the lines to:
Code:
<{if $_item[defaulttitle] != 'Knowledgebase' || 'Home' }>
and this causes all links to open a new window.

When I change them to:
Code:
<{if $_item[defaulttitle] != 'Knowledgebase' && 'Home' }> 
only the first link which is "Knowledgebase" stays in the browser but I also need home to do the same. Any suggests???

Reply With Quote
  #2  
Old December 4th, 2012, 07:34 PM
Kravvitz's Avatar
Kravvitz Kravvitz is offline
CSS & JS/DOM Adept
Dev Shed God 30th Plane (19500 - 19999 posts)
 
Join Date: Jul 2004
Location: USA
Posts: 19,835 Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level)Kravvitz User rank is General 48th Grade (Above 100000 Reputation Level) 
Time spent in forums: 6 Months 1 Day 22 h 1 m 5 sec
Reputation Power: 4192
Welcome to DevShed Forums, MCtechsupport.

This looks more like a server-side template system than JavaScript, but I'll try to help anyway.

As convenient as it might be sometimes, that's not how logical operators work. You need to repeat the comparison:
Code:
<{if $_item[defaulttitle] != 'Knowledgebase' && $_item[defaulttitle] != 'Home' }>

P.S. Thanks for using the bbcode "code" tags.
__________________
Spreading knowledge, one newbie at a time. I'm available for hire at Dynamic Site Solutions.

Check out my blog. | Learn CSS. | PHP includes | X/HTML Validator | CSS validator | Common CSS Mistakes | Common JS Mistakes

Remember people spend most of their time on other people's sites (so don't violate web design conventions).

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignJavaScript Development > Other - Need Help Formating If/Or Statement

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap