/    Sign up×
Community /Pin to ProfileBookmark

problem with a conditional

Hey all, it’s 2am and ive been up for awhile building a client site. Ive run into a stumbling block that is more than likely a result of my tired eyes and numb brain. I have browser detection for IE6 and NN7 (as per client request) and am not having a problem with that aspect. I am having problems running and if statement – which usually isnt a problem. Here’s the code. If you can point out the lame bit of whatever I am missing Ill sure appreciate it!

function browserDetect(){
//alert(‘isIE6up: ‘+browser.isIE6up+’ | isNS7up: ‘+browser.isNS7up+’ | isMac: ‘+browser.isMac);

var ns7 = browser.isNS7up;
alert(‘ns7=’+ns7);
if(ns7 == “true”){
alert(‘youre ok’);
}else{
alert(‘you will be redirected’);
}

}

Let’s say the value ns7 respresents is TRUE. The if/else is not getting it right. Which leads me to believe Im not getting it right. In other words when the value of ns7 is false, it still goes through to the ‘else’ portion.

Help my tired eyes! And sorry for any lameness!

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@senshiNov 05.2004 — (ns7 == true) and not (ns7 == "true")

your testing logic and not a string.
Copy linkTweet thisAlerts:
@KorNov 05.2004 — On the other hand, boolean values are operators on the same time, so instead of

if(object==true)

if(object==false)

you may also use simple

if(object)

if(!object)
Copy linkTweet thisAlerts:
@bionicleauthorNov 05.2004 — Thank you both. Need more caffeine and some glasses!
×

Success!

Help @bionicle spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...