/    Sign up×
Community /Pin to ProfileBookmark

[RESOLVED] How do I make two things happen for one condition (if statement)

[code=html]
// Part of a HTML Script Tag
if (Time == 00)
{document.write(“Ow, it’s tommorow already! Just the beginning of the day!”)
&&
document.Status.src=”iImages/S6-1.jpg”}

else if (Time > 00 && Time <= 05)
{document.write(“Ow why are you awake now?! It’s still too ERALY!”)
&&
document.Status.src=”Images/S6-2″}

else if (Time > 05 && Time <= 12)
{document.write(“Good morning!”)
&&
document.Status.src=”Images/S6-3″)

else if (Time > 12 && Time <= 18)
{document.write(“Good afternoon!”)
&&
document.Status.src=”Images/S6-4″}

else if (Time > 18 && Time <= 22)
{document.write(“Good night!”)
&&
document.Status.src=”Images/S6-5″}

else
{document.write(“Go get some sleeeeeeep maan!”)
&&
document.Status.src=”Images/S6-6″}
}
[/code]

I used the “[B]&&[/B]” operator but it gives me a [i]syntax[/i] error. What shall I use? semicolon??

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@toicontienJul 10.2007 — Yes, a semi colon. The && operator is a logical operator. Think of the semi colon as the period (.) of a programming sentence. It separates one command from the next.
Copy linkTweet thisAlerts:
@____MaNiC_MoE____authorJul 10.2007 — thx - It worked and thanks 4 da (.) tip! :p
×

Success!

Help @____MaNiC_MoE____ 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 6.16,
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: @nearjob,
tipped: article
amount: 1000 SATS,

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

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...